Skip to content
Snippets Groups Projects
Commit 3d5546a0 authored by Nils Schild's avatar Nils Schild Committed by Sebastian Eibl
Browse files

Apply 1 suggestion(s) to 1 file(s)

parent 244b83b6
No related branches found
No related tags found
1 merge request!5add example for cmake presets
# How to add compilation configurations to your project? # How to add compilation configurations to your project?
Since 3.19 CMake supports [presets](https://cmake.org/cmake/help/latest/manual/cmake-presets.7.html). Presets are able ## Brief
to replace your custom shell scripts that build your application on different platforms with different settings. [Presets](https://cmake.org/cmake/help/latest/manual/cmake-presets.7.html) are able to replace your custom shell scripts that build your application on different platforms with different settings. Since 3.19 CMake supports presets.
Presets have a name and specify flags for the configure, build, test, install, etc stage. There are two files
that contain presets. `CMakePresets.json` holds the project-wide presets that are checked into the repository. ## Description
`CMakeUserPresets.json` contains developer specific settings and should not be part of the repository. In fact, you should Presets are based on two main files.
at it to your `.gitignore` file. * `CMakePresets.json` holds the project-wide presets that are checked into the repository.
\ No newline at end of file * `CMakeUserPresets.json` contains developer specific settings and should not be part of the repository.\
(In fact, you should at it to your `.gitignore` file.)
Presets have a name and specify flags for the configure, build, test, install, etc stage.
To invoke a preset configuration during the configure stage use e.g.
`
cmake --preset <ConfigurePreset> -S <SourceDirectory> -B <BuildDirectory>
`
or during the build stage use
`
cmake --preset <BuildPreset> --build <BuildDirectory>
`
How this minimal example is used in a CMake workflow is shown in [.gitlab-ci.yml](../.gitlab-ci.yml)
Many further details can be found in the CMake documentation for presets [](https://cmake.org/cmake/help/latest/manual/cmake-presets.7.html)
\ No newline at end of file
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment