1
0
mirror of https://github.com/Kitware/CMake.git synced 2025-10-16 22:37:30 +08:00

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

This form already works.  Document it and add tests.

Issue: #21855
This commit is contained in:
Brad King
2021-02-23 08:45:12 -05:00
parent c2c31ae896
commit 2f13fdef0a
9 changed files with 22 additions and 5 deletions

View File

@@ -377,7 +377,7 @@ Options
about:tracing tab of Google Chrome or using a plugin for a tool like Trace about:tracing tab of Google Chrome or using a plugin for a tool like Trace
Compass. Compass.
``--preset=<preset>`` ``--preset <preset>``, ``--preset=<preset>``
Reads a :manual:`preset <cmake-presets(7)>` from Reads a :manual:`preset <cmake-presets(7)>` from
``<path-to-source>/CMakePresets.json`` and ``<path-to-source>/CMakePresets.json`` and
``<path-to-source>/CMakeUserPresets.json``. The preset specifies the ``<path-to-source>/CMakeUserPresets.json``. The preset specifies the

View File

@@ -64,7 +64,7 @@ const char* cmDocumentationUsageNote[][2] = {
const char* cmDocumentationOptions[][2] = { const char* cmDocumentationOptions[][2] = {
CMAKE_STANDARD_OPTIONS_TABLE, CMAKE_STANDARD_OPTIONS_TABLE,
{ "--preset=<preset>", "Specify a configure preset." }, { "--preset <preset>,--preset=<preset>", "Specify a configure preset." },
{ "--list-presets", "List available presets." }, { "--list-presets", "List available presets." },
{ "-E", "CMake command mode." }, { "-E", "CMake command mode." },
{ "-L[A][H]", "List non-advanced cached variables." }, { "-L[A][H]", "List non-advanced cached variables." },

View File

@@ -132,7 +132,13 @@
{ {
"name": "Good Spaces", "name": "Good Spaces",
"generator": "@RunCMake_GENERATOR@", "generator": "@RunCMake_GENERATOR@",
"binaryDir": "${sourceDir}/build" "binaryDir": "${sourceDir}/build",
"cacheVariables": {
"GOOD_SPACES": {
"type": "STRING",
"value": "1"
}
}
}, },
{ {
"name": "GoodWindowsBackslash", "name": "GoodWindowsBackslash",

View File

@@ -0,0 +1,3 @@
Preset CMake variables:
GOOD_SPACES:STRING="1"

View File

@@ -0,0 +1,3 @@
Preset CMake variables:
GOOD_SPACES:STRING="1"

View File

@@ -0,0 +1 @@
1

View File

@@ -0,0 +1,2 @@
^CMake Error: No preset specified for --preset
CMake Error: Run 'cmake --help' for all supported options.$

View File

@@ -143,7 +143,8 @@ run_cmake_presets(GoodBinaryUp)
set(CMakePresets_SOURCE_ARG "../GoodBinaryRelative") set(CMakePresets_SOURCE_ARG "../GoodBinaryRelative")
run_cmake_presets(GoodBinaryRelative) run_cmake_presets(GoodBinaryRelative)
unset(CMakePresets_SOURCE_ARG) 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) if(WIN32)
run_cmake_presets(GoodWindowsBackslash) run_cmake_presets(GoodWindowsBackslash)
endif() endif()
@@ -206,7 +207,8 @@ endif()
# Test bad command line arguments # Test bad command line arguments
run_cmake_presets(NoSuchPreset) 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) run_cmake_presets(UseHiddenPreset)
# Test CMakeUserPresets.json # Test CMakeUserPresets.json