Skip to content

CMake presets

Lars Bilke requested to merge bilke/ogs:cmake-presets into master

Make use of CMake presets. Using this requires CMake 3.19.

Build configuration presets are defined in CMakePresets.json

Usage:

# In OGS source code directory
cmake -S . --preset release

This will create a configured build in ogs/build/release with the Ninja generator and some predefined options.

Developer can create a CMakeUserPresets.json file in the root source directory with their own presets (this file is ignored by git).

Documentation preview


  1. Feature description was added to the changelog
  2. Tests covering your feature were added?
  3. Any new feature or behavior change was documented?

Things to discuss:

  • Shall the build be in-source (ogs/build/[config-name]) or not (ogs/../build-[config-name])?
  • Is the preset naming scheme good? [generator]-[release|debug]-[gui|petsc|...], see name-field in CMakePresets.json.
  • Are there any useful presets missing?
  • Shall the top-level default CMake options in the default preset (release) also become the defaults in CMake in general? (OGS_BUILD_UTILS and OGS_USE_PYTHON)
Edited by Lars Bilke

Merge request reports