Private archive copy · Unofficial site · Content copyright belongs to Runoob Tutorial and the original authors · View Original

CMake Tutorial

CMake Tutorial

CMake is an open-source, cross-platform automated build system used to manage the software build process; it does not depend on a particular compiler and supports multiple directories, applications and libraries.

Through the simple configuration file CMakeLists.txt, CMake automatically generates build files for different platforms (such as Makefile, Ninja build files and Visual Studio project files), simplifying compiling and building a project.

CMake itself is not a build tool but a tool that generates build systems; the generated build system can use different compilers and toolchains.


What CMake does and its advantages


Build configuration


Basic workflow

  1. Write the CMakeLists.txt file: Define the project's build rules and dependencies.
  2. Generate build files: Use CMake to generate build system files suited to the current platform (for example a Makefile or Visual Studio project files).
  3. Run the build: Use the generated build system files (such as make, ninja, msbuild) to compile the project.


Related links