Condition field for workflow presets (original) (raw)

November 23, 2022, 5:53am 1

Workflows presets don’t currently have a condition field, which is unfortunate. Some workflows may consist of platform-specific presets, such as building for XCode or Visual Studio.

I suggest either:

ben.boeckel (Ben Boeckel (Kitware)) November 23, 2022, 11:24pm 2

The former makes more sense to me. Maybe one wants to skip a step in some situation (e.g., testing for clang-tidy?) and having to do a new workflow for that seems a bit unfortunate.

craig.scott (Craig Scott) November 24, 2022, 10:17pm 3

Having a workflow silently skip steps for which a condition is false seems attractive at first, but I would have concerns about the robustness of that. Giving workflow presets as a whole a condition field would be less risky.

benthevining (Ben Vining) November 25, 2022, 1:49am 4

If workflows are going to allow but skip steps that have false conditions, then I would suggest that CMake exits with a success code if at least the configure preset had a true condition, and exits with a failure code otherwise.

ClausKlein (Claus Klein) August 4, 2023, 5:25am 5

IMHO: It is a bug, if the workflow preset does not inherit the condition of its configure preset:

bash-3.2$ cmake --workflow --list-presets
Available workflow presets:

  "windows-clang-debug"
  "windows-clang-release"
  "clang-debug"
  "clang-release"
  "gcc-debug"
  "gcc-release"
bash-3.2$ cmake --list-presets
Available configure presets:

  "gcc-debug"     - gcc Debug
  "gcc-release"   - gcc Release
  "clang-debug"   - clang Debug
  "clang-release" - clang Release
bash-3.2$ cmake --workflow --preset=windows-clang-debug
CMake Error: Cannot use disabled configure preset in /Users/clausklein/Workspace/cmake/project_options/examples/cpp_vcpkg_project: "windows-clang-debug"
bash-3.2$ 

ClausKlein (Claus Klein) August 4, 2023, 7:39am 6

A conditionally disabled preset should be allowed to have a duplicate name

bash-3.2$ !json
jsonschema -i CMakePresets.json schema.json 
bash-3.2$ jsonschema -i CMakePresets.json schema.json 
bash-3.2$ cmake --workflow --list-presets
CMake Error: Could not read presets from /Users/clausklein/Workspace/cmake/project_options/examples/cpp_vcpkg_project:
Duplicate preset: "clang-install"
bash-3.2$ 

That would help to write simple and clear CMakePresets.json.

ClausKlein (Claus Klein) August 4, 2023, 4:56pm 7

@craig.scott @ben.boeckel Is it planed to change this behaviour?

ben.boeckel (Ben Boeckel (Kitware)) August 7, 2023, 11:23am 8

I’m not that familiar with presets. @kyle.edwards would know more.

ClausKlein (Claus Klein) August 18, 2023, 1:00pm 9

ClausKlein (Claus Klein) February 1, 2024, 3:08pm 10

ClausKlein (Claus Klein) February 2, 2024, 11:36am 11

I have created an issue

ClausKlein (Claus Klein) April 2, 2024, 7:17pm 12