The difference and meaning of cmake and make

cmake和make

What does make cmake compile and so on under Linux mean?
https://blog.csdn.net/freeking101/article/details/51610782/

The general steps of writing a program are:
1. Use an editor to write the source code, such as a .c file.
2. Use a compiler to compile the code to generate an object file, such as .o.
3. Use the linker to connect the target code to generate an executable file, such as .exe.

But if there are too many source files, it will be particularly troublesome to compile one by one, so people thought, why not design a batch-like program to compile the source files in batches, so there is the make tool, which is an automation Compilation tool, you can use one command to achieve complete compilation. But you need to write a rule file, and make is based on it for batch compilation. This file is a makefile, so writing a makefile is also a necessary skill for a programmer.

For a large project, writing a makefile is really complicated, so people thought, why not design a tool, after reading all the source files, automatically generate the makefile, so the cmake tool appeared, which can output all kinds of This kind of makefile or project file can help programmers reduce the burden. But what follows is to write the cmakelist file, which is the rule that cmake is based on. So there are no shortcuts in the world of programming, but you have to keep your feet on the ground.

image.png

sudo make -j8

-j8 means parallel calculation, set according to the configuration of your own computer, the computer with lower configuration can change the number to a smaller value or not use it, and directly enter make.

Guess you like

Origin blog.csdn.net/LemonShy2019/article/details/114680340