tldr/pages/common/cmake.md

29 lines
969 B
Markdown
Raw Normal View History

2016-11-30 21:23:28 +00:00
# cmake
2021-01-21 17:25:34 +00:00
> Cross-platform build automation system, that generates recipes for native build systems.
2020-11-16 18:53:30 +00:00
> More information: <https://cmake.org/cmake/help/latest/manual/cmake.1.html>.
2016-11-30 21:23:28 +00:00
- Generate a build recipe in the current directory with `CMakeLists.txt` from a project directory:
2016-11-30 21:23:28 +00:00
`cmake {{path/to/project_directory}}`
2016-11-30 21:23:28 +00:00
- Generate a build recipe, with build type set to `Release` with CMake variable:
2021-01-21 17:25:34 +00:00
`cmake {{path/to/project_directory}} -D {{CMAKE_BUILD_TYPE=Release}}`
2021-01-21 17:25:34 +00:00
- Use a generated recipe in a given directory to build artifacts:
2016-11-30 21:23:28 +00:00
`cmake --build {{path/to/build_directory}}`
2021-01-21 17:25:34 +00:00
- Install the build artifacts into `/usr/local/` and strip debugging symbols:
`cmake --install {{path/to/build_directory}} --strip`
- Install the build artifacts using the custom prefix for paths:
`cmake --install {{path/to/build_directory}} --strip --prefix {{path/to/directory}}`
- Run a custom build target:
2021-01-21 17:25:34 +00:00
`cmake --build {{path/to/build_directory}} --target {{target_name}}`