diff options
author | Brad King <brad.king@kitware.com> | 2021-02-23 13:45:12 (GMT) |
---|---|---|
committer | Brad King <brad.king@kitware.com> | 2021-02-23 14:11:32 (GMT) |
commit | 2f13fdef0a9471165751f628cb4b2ba7b83b1ae1 (patch) | |
tree | 529e80f5c9df0f6618e5dce7a97a13bba26b321a | |
parent | c2c31ae8969686f1909fe76fef43a232332c7b54 (diff) | |
download | CMake-2f13fdef0a9471165751f628cb4b2ba7b83b1ae1.zip CMake-2f13fdef0a9471165751f628cb4b2ba7b83b1ae1.tar.gz CMake-2f13fdef0a9471165751f628cb4b2ba7b83b1ae1.tar.bz2 |
cmake: Document '--preset <preset>' form of the argument
This form already works. Document it and add tests.
Issue: #21855
-rw-r--r-- | Help/manual/cmake.1.rst | 2 | ||||
-rw-r--r-- | Source/cmakemain.cxx | 2 | ||||
-rw-r--r-- | Tests/RunCMake/CMakePresets/CMakePresets.json.in | 8 | ||||
-rw-r--r-- | Tests/RunCMake/CMakePresets/GoodSpaces-stdout.txt | 3 | ||||
-rw-r--r-- | Tests/RunCMake/CMakePresets/GoodSpacesEq-stdout.txt | 3 | ||||
-rw-r--r-- | Tests/RunCMake/CMakePresets/GoodSpacesEq.cmake | 0 | ||||
-rw-r--r-- | Tests/RunCMake/CMakePresets/NoPresetArgumentEq-result.txt | 1 | ||||
-rw-r--r-- | Tests/RunCMake/CMakePresets/NoPresetArgumentEq-stderr.txt | 2 | ||||
-rw-r--r-- | Tests/RunCMake/CMakePresets/RunCMakeTest.cmake | 6 |
9 files changed, 22 insertions, 5 deletions
diff --git a/Help/manual/cmake.1.rst b/Help/manual/cmake.1.rst index b2bd1ed..1759b9d 100644 --- a/Help/manual/cmake.1.rst +++ b/Help/manual/cmake.1.rst @@ -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 diff --git a/Source/cmakemain.cxx b/Source/cmakemain.cxx index cd3c955..4260ca2 100644 --- a/Source/cmakemain.cxx +++ b/Source/cmakemain.cxx @@ -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." }, diff --git a/Tests/RunCMake/CMakePresets/CMakePresets.json.in b/Tests/RunCMake/CMakePresets/CMakePresets.json.in index 54e4140..d4d1838 100644 --- a/Tests/RunCMake/CMakePresets/CMakePresets.json.in +++ b/Tests/RunCMake/CMakePresets/CMakePresets.json.in @@ -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", diff --git a/Tests/RunCMake/CMakePresets/GoodSpaces-stdout.txt b/Tests/RunCMake/CMakePresets/GoodSpaces-stdout.txt new file mode 100644 index 0000000..d106c45 --- /dev/null +++ b/Tests/RunCMake/CMakePresets/GoodSpaces-stdout.txt @@ -0,0 +1,3 @@ +Preset CMake variables: + + GOOD_SPACES:STRING="1" diff --git a/Tests/RunCMake/CMakePresets/GoodSpacesEq-stdout.txt b/Tests/RunCMake/CMakePresets/GoodSpacesEq-stdout.txt new file mode 100644 index 0000000..d106c45 --- /dev/null +++ b/Tests/RunCMake/CMakePresets/GoodSpacesEq-stdout.txt @@ -0,0 +1,3 @@ +Preset CMake variables: + + GOOD_SPACES:STRING="1" diff --git a/Tests/RunCMake/CMakePresets/GoodSpacesEq.cmake b/Tests/RunCMake/CMakePresets/GoodSpacesEq.cmake new file mode 100644 index 0000000..e69de29 --- /dev/null +++ b/Tests/RunCMake/CMakePresets/GoodSpacesEq.cmake diff --git a/Tests/RunCMake/CMakePresets/NoPresetArgumentEq-result.txt b/Tests/RunCMake/CMakePresets/NoPresetArgumentEq-result.txt new file mode 100644 index 0000000..d00491f --- /dev/null +++ b/Tests/RunCMake/CMakePresets/NoPresetArgumentEq-result.txt @@ -0,0 +1 @@ +1 diff --git a/Tests/RunCMake/CMakePresets/NoPresetArgumentEq-stderr.txt b/Tests/RunCMake/CMakePresets/NoPresetArgumentEq-stderr.txt new file mode 100644 index 0000000..a53682d --- /dev/null +++ b/Tests/RunCMake/CMakePresets/NoPresetArgumentEq-stderr.txt @@ -0,0 +1,2 @@ +^CMake Error: No preset specified for --preset +CMake Error: Run 'cmake --help' for all supported options.$ diff --git a/Tests/RunCMake/CMakePresets/RunCMakeTest.cmake b/Tests/RunCMake/CMakePresets/RunCMakeTest.cmake index 25a7f2f..114abc5 100644 --- a/Tests/RunCMake/CMakePresets/RunCMakeTest.cmake +++ b/Tests/RunCMake/CMakePresets/RunCMakeTest.cmake @@ -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 |