What are the main differences between makefile and CMakeList

I searched for the main differences between makefile and CMakeLists, but found weak differences like CMake automates dependency resolution, whereas Make is manual.

I'm looking for the main differences, what are the pros and cons of me migrating to CMake?

+4
source share
1 answer

You can compare CMake with Autotools . It makes sense! If you do, you can learn about the drawbacks of make, which are the reason for creating Autotools and the obvious advantages of CMake over make.

Autoconf solves an important problem - reliable detection of assembly system information and runtime, but this is just one part of the puzzle for portable software development. To this end, the GNU project developed a set of integrated utilities to shut down Autoconf: the GNU build system, the most important components of which are Autoconf, Automake, and Libtool.

Make cannot do this. In any case, not out of the box. You can do this, but it will take a lot of time supporting it on different platforms.

CMake solves the same problem (and much more), but has several advantages over the GNU Build System.

  • The language used to write CMakeLists.txt files is readable and more understandable.
  • He not only relies on make to create the project. It supports multiple generators such as Visual Studio, Xcode, Eclipse, etc.

When comparing CMake with make, there are several more advantages to using CMake:

  • Cross-platform discovery of system libraries.
  • Automatic tool chain discovery and configuration.
  • It is easier to compile your files into a common library in the agnostic mode of the platform and, in general, easier to use than make.

General CMake is obviously a choice compared to what to do, but you should be aware of a few things.

  • CMake does more than just make it more complex. Ultimately, it pays to learn how to use it, but if you only have a small project on only one platform, then maybe make can do a better job.
  • The CMake documentation may seem concise at first. There are textbooks, but there are many aspects that need to be covered up, and they don’t do a really good job to cover it all. Thus, you will only find introductory material in the main. You will have to figure out the rest of the documentation and real-life examples: there are many open source projects using CMake, so you can explore them.
+10
source

Source: https://habr.com/ru/post/1432465/


All Articles