CMake cheat sheet!
by Baduit
Article::Article
This is just a reminder of some commands I often use and why not share it if it can help someone.
The basics
Generate
Generate the project into path_to_build_directory (the base CMakeLists.txt must is in the current path)
Build
Build the project in path_to_build_directory
Test
Launch the tests with the root in path_to_build_directory
Common stuff
Toolchain integration
Specify the generator
Override an option/variable
Now MY_VAR will have the value : ON (ON/OFF can be used for boolean value with CMake)
Vcpkg
On all example there is an env variable named VCPKG_ROOT with path where you can find vcpkg.
Simple use of vcpkg
With Powershell
The quotes are meaningful
With Bash
Specify additionnal toolchain
Specify the triplet
With the triplet for emscripten
Use Both
An example with emscripten for one of my projects
Article::~Article
I hope theses commands will improve your daily life with cmake, or you can just use an IDE that launch the build by just pressing ctrl+b.