cmake: Document '--preset <preset>' form of the argument
This form already works. Document it and add tests. Issue: #21855
This commit is contained in:
parent
c2c31ae896
commit
2f13fdef0a
@ -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",
|
||||
|
3
Tests/RunCMake/CMakePresets/GoodSpaces-stdout.txt
Normal file
3
Tests/RunCMake/CMakePresets/GoodSpaces-stdout.txt
Normal file
@ -0,0 +1,3 @@
|
||||
Preset CMake variables:
|
||||
|
||||
GOOD_SPACES:STRING="1"
|
3
Tests/RunCMake/CMakePresets/GoodSpacesEq-stdout.txt
Normal file
3
Tests/RunCMake/CMakePresets/GoodSpacesEq-stdout.txt
Normal file
@ -0,0 +1,3 @@
|
||||
Preset CMake variables:
|
||||
|
||||
GOOD_SPACES:STRING="1"
|
0
Tests/RunCMake/CMakePresets/GoodSpacesEq.cmake
Normal file
0
Tests/RunCMake/CMakePresets/GoodSpacesEq.cmake
Normal file
@ -0,0 +1 @@
|
||||
1
|
@ -0,0 +1,2 @@
|
||||
^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
|
||||
|
Loading…
Reference in New Issue
Block a user