Skip to content
Snippets Groups Projects
Commit 2f13fdef authored by Brad King's avatar Brad King
Browse files

cmake: Document '--preset <preset>' form of the argument

This form already works.  Document it and add tests.

Issue: #21855
parent c2c31ae8
No related branches found
No related tags found
No related merge requests found
......@@ -377,7 +377,7 @@ Options
about:tracing tab of Google Chrome or using a plugin for a tool like Trace
Compass.
``--preset=<preset>``
``--preset <preset>``, ``--preset=<preset>``
Reads a :manual:`preset <cmake-presets(7)>` from
``<path-to-source>/CMakePresets.json`` and
``<path-to-source>/CMakeUserPresets.json``. The preset specifies the
......
......@@ -64,7 +64,7 @@ const char* cmDocumentationUsageNote[][2] = {
const char* cmDocumentationOptions[][2] = {
CMAKE_STANDARD_OPTIONS_TABLE,
{ "--preset=<preset>", "Specify a configure preset." },
{ "--preset <preset>,--preset=<preset>", "Specify a configure preset." },
{ "--list-presets", "List available presets." },
{ "-E", "CMake command mode." },
{ "-L[A][H]", "List non-advanced cached variables." },
......
......@@ -132,7 +132,13 @@
{
"name": "Good Spaces",
"generator": "@RunCMake_GENERATOR@",
"binaryDir": "${sourceDir}/build"
"binaryDir": "${sourceDir}/build",
"cacheVariables": {
"GOOD_SPACES": {
"type": "STRING",
"value": "1"
}
}
},
{
"name": "GoodWindowsBackslash",
......
Preset CMake variables:
GOOD_SPACES:STRING="1"
Preset CMake variables:
GOOD_SPACES:STRING="1"
1
^CMake Error: No preset specified for --preset
CMake Error: Run 'cmake --help' for all supported options.$
......@@ -143,7 +143,8 @@ run_cmake_presets(GoodBinaryUp)
set(CMakePresets_SOURCE_ARG "../GoodBinaryRelative")
run_cmake_presets(GoodBinaryRelative)
unset(CMakePresets_SOURCE_ARG)
run_cmake_presets(GoodSpaces "--preset=Good Spaces")
run_cmake_presets(GoodSpaces "--preset" "Good Spaces")
run_cmake_presets(GoodSpacesEq "--preset=Good Spaces")
if(WIN32)
run_cmake_presets(GoodWindowsBackslash)
endif()
......@@ -206,7 +207,8 @@ endif()
# Test bad command line arguments
run_cmake_presets(NoSuchPreset)
run_cmake_presets(NoPresetArgument --preset=)
run_cmake_presets(NoPresetArgument --preset)
run_cmake_presets(NoPresetArgumentEq --preset= -DA=B)
run_cmake_presets(UseHiddenPreset)
# Test CMakeUserPresets.json
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment