Skip to content

Files

Latest commit

5321756 · Sep 21, 2018

History

History
This branch is 2 commits ahead of dev-cafe/cmake-cookbook:master.

recipe-02

Switching generators

A single CMakeLists.txt can be used to configure projects for different toolstacks on different platforms. CMake is a build system generator. Starting from a description of the operations the build system, e.g. Unix Makefiles, Ninja, Visual Studio, etc., will have to run to get your code compiled, CMake generates the corresponding instructions for the chosen build system.

CMake supports an extensive list of native build tools for the different platforms. It is possible to get a list of the available ones for the currently installed version of CMake on the current platform by running:

cmake --help

As an example, to use the Ninja generator, configure with:

cmake -H. -Bbuild -GNinja