As you know, the general steps to write a program are:
1. Write the source code, such as a. c file, with the editor.
2. Compile the code with the compiler to generate the target file, such as. O.
3. Connect the target code with the linker to generate the executable file, such as. exe.
But if the source file is too many, one compile will be particularly troublesome, so people think, why not design a batch-like program, to batch compile the source file, so there is the make tool, it is an automated compilation tool, you can use a command to achieve full compilation. But you need to write a rule file, make the batch compilation according to it, this file is makefile, so writing makefile file is also a necessary skill for a programmer.
For a big project, writing makefile is really a complex thing, so people think, why not design a tool, read all the source files, automatically generate makefile, so there is a cmake tool, It can output a variety of Makefile or project files to help programmers reduce their burden. But then comes the writing of the Cmakelist file, which is the rule on which CMake is based. So in the programming world there is no shortcut to go, or to down-to-earth.
Original file--camkelist---cmake---makefile---make---generate executable file
C Language Programming process