In this article, we have explored the differences between Make and CMake in depth. We have presented a table summarizing the differences as well.
Table of contents:
- Background of Make and CMake
- Make vs Cmake
- Summary Table
Background of Make and CMake
Make tool was developed in April 1976 by Bell Labs. In 1976, software using Make to compile and run it had a Makefile and the steps to compile it were:
As different systems started to emerged in the Industry, developers needed to compile the same source code in different systems. This came with a problem as the Makefile need different parameters for different systems. Developers had to edit the Makefile to compile the source code on a specific system.
The immediate solution was to set up a configuration script to customized the Makefile according to the current system. This involved a new file named Makefile.in which stored the configuration details and another script named configure which used the Makefile.in to update Makefile according to the system. With this, the steps were updated to:
This worked well for some time but the problem grew bigger as the system variations became large. Maintaining the configure and Makefile.in was complex and was a large file (sometimes, bigger than the actual source code). Developers attempted to simplify the process by using tools like automake, m4 and autoconf. The complexity of the build process was increasing gradually.
It was in 2000 that CMake was introduced by Kitware which simplified the entire build process again. The steps with CMake are as follows:
cmake -DLLVM_ENABLE_PROJECTS=clang -G "Unix Makefiles"
Make vs Cmake
The major differences between Make and CMake are:
- Make is a build system while CMake is a generator of build systems like Make and Ninja. So, CMake is an optional layer over Make.
- CMake is used to make the software portable across different systems like Windows, UNIX, embedded devices and much more as it can generate any build system that supports the system. Make is for UNIX systems and is highly optimized but does not support portability across new devices. So, if the software aims to support all users, then CMake is the best option. If the software aims to support only UNIX users as first preference, then Make is a good choice.
- Recursive Make files: CMake has a big limitation that it supports only well defined hierarchy of 3 levels without back loops. This makes CMake restricted but safe. On the other hand, Make supports recursive makefiles of any level. Recursive makefile means a top level makefile will invoke a makefile in a sub-project in a specific order.
- CMake has a file "CMakeFile.txt" while Make tool has a file "Makefile".
- CMake stands for Cross Platform Make.
- Make tool was developed in April 1976. CMake was developed in 2000 that is 24 years after Make.
- CMake has a support for Graphic User Interface (GUI) while Make does not have any GUI.
- Currently, CMake is actively maintained and new features are being developed. On the other hand, Make tool is not actively maintained currently.
- In general, using CMake is easier for beginners compared to Make tool.
- CMake tracks how a software was build while Make does not track it. So, if an library is removed after building, it will not be rebuilt by Make but CMake will take care of it.
- Both CMake and Make are Turing Complete Programming Languages. CMake has 3 variables namely string, list and target with properties while Make has only one datatype that is string. Both CMake and Make does not have any user defined data types.
- CMake can be used to generate build files for build tools other than Make as well like Ninja, QtCreator, KDEvelop.
- Make is currently, managed by Free Software Foundation (FSF) and is not an open-source software. It is a free tool. On the other hand, CMake is an open-source project.
Following table summarize the differences between Make and CMake:
Make vs CMake
|Differences between Make and CMake
Prepared by iq.OpenGenus.org
|3 Level limit
As a concluding note, you should use Make if you are working on a project which aims to build and run on only one system and want to support recursively building with depth > 3.
You should use CMake if you are working on a project which aims to support a wide range of systems. CMake will be a cleaner and better option than Make in this case.