Skip to content

cmake

  • CMake configuration CMakeLists.txt
  • Upon running Cmake a set of Makefiles are created in the build directory
mkdir build
cd build
cmake .. # build the previous dir (the project root) in the current dir (the build dir)
make # run the auto-generated make file

-S

  • Explicitly specify a source directory
  • Usually the project's root
cmake -S "." -B "build"
cmake -B "build" # same, uses the current directory by default

-B

  • Explicitly specify a build directory.
cmake -S "." -B "build"

-D

  • Create or update a cmake cache entry
cmake -DCMAKE_EXPORT_COMPILE_COMMANDS=1