CMake generates files for other build systems. These can be Makefiles, Ninja files or projects files for IDEs like Visual Studio or Eclipse. The build files contain calls to compilers like GCC, Clang, or cl.exe. If you have several compilers installed, you can choose one.
All three parts are independent. The compiler, the build system and CMake.
It is easier to understand when you have the history. People used their compiler. Over time they added so many flags, that it was cumbersome to type them every time. So they put the calls in a script. From that the build systems (Make, Ninja) evolved.
The people wanted to support multiple platforms, compilers, scenarios and so on and the build system files became hard to maintain and their use was error-prone. That’s the reason people invented meta build system that creates the files for the actual build system. Examples are Autotools or CMake.
- Yes
- CMake does not use your compiler, make does not implement it, but it calls (uses) the compiler.
- The CMakeLists.txt file should be in the parent directory of
release
. The last argument of the CMake call indicates the path where the CMakeLists.txt file is located. - Right, make generates the file in the build directory. In your example from 3.
release
is the build directory. You can find all the generated files and use them. Installing is optional, especially if you want to develop the software, you are not installing it. - Try writing Makefiles for a large project and you will see how much work it is. But yes, everything in 5 is right.