CMake by Example
CMake is an open source cross-platform meta build system that works on Windows, macOS, Linux, and more. It is designed to bridge the gap between the platform-specific build tools such as Ninja, GNU Make, BSD Make, Visual Studio, and Xcode. You can read more about CMake on the official CMake.org website. CMake is best known for its unmatched popularity as the primary C/C++ build tool.
CMake by Example is a hands-on introduction to how to use CMake to build C/C++ projects using annotated example projects. Make sure you have installed the latest version of CMake on your system. Check out the first Hello world example to get started.
- Hello world
- Logging
- Values
- Variables
- Executables
- Libraries
- Headers
- If/else
- For
- Arrays
- Functions
- Macros
- Toolchain files
- Custom targets
- Post-build commands
- FetchContent dependency
- Conan dependency
- Vcpkg dependency
- Xrepo dependency
- FindPackage dependency
- cosmocc toolchain
- Zig toolchain
- Spawning processes
- HTTP requests
- String functions
- JSON
- Environment variables
- Feature detection
- clang-format
- cmake-format
- Vendoring
- Build & test GitHub Actions
- Workflows
- Testing
- GTest testing
- Unity testing
- Packaging
- Release GitHub Actions
- Install target
- Scripts