diff options
author | Brad King <brad.king@kitware.com> | 2021-02-24 14:46:13 (GMT) |
---|---|---|
committer | Kitware Robot <kwrobot@kitware.com> | 2021-02-24 14:46:52 (GMT) |
commit | e95f7aa0ed4a13e6d36b97fe5a4a3ead1faa13ab (patch) | |
tree | 167739e84a2f4d00ba9bc2cd3eb43767f7847ca3 /Source | |
parent | 14c6a88db6ed5683688b1d9211f2466faa0e563d (diff) | |
parent | 6fa36470239a40ef81752ddea923d8618ad6eb7c (diff) | |
download | CMake-e95f7aa0ed4a13e6d36b97fe5a4a3ead1faa13ab.zip CMake-e95f7aa0ed4a13e6d36b97fe5a4a3ead1faa13ab.tar.gz CMake-e95f7aa0ed4a13e6d36b97fe5a4a3ead1faa13ab.tar.bz2 |
Merge topic 'preset-flag-consistency' into release-3.20
6fa3647023 ctest: Add support for '--prefix=<prefix>' form of the argument
3357d37761 cmake: Add support for '--build --prefix=<prefix>' form of the argument
2f13fdef0a cmake: Document '--preset <preset>' form of the argument
Acked-by: Kitware Robot <kwrobot@kitware.com>
Merge-request: !5849
Diffstat (limited to 'Source')
-rw-r--r-- | Source/cmCTest.cxx | 10 | ||||
-rw-r--r-- | Source/cmakemain.cxx | 5 | ||||
-rw-r--r-- | Source/ctest.cxx | 3 |
3 files changed, 13 insertions, 5 deletions
diff --git a/Source/cmCTest.cxx b/Source/cmCTest.cxx index e8d7c05..620ba19 100644 --- a/Source/cmCTest.cxx +++ b/Source/cmCTest.cxx @@ -2574,7 +2574,10 @@ int cmCTest::Run(std::vector<std::string>& args, std::string* output) bool listPresets = find(args.begin(), args.end(), "--list-presets") != args.end(); - auto it = find(args.begin(), args.end(), "--preset"); + auto it = + std::find_if(args.begin(), args.end(), [](std::string const& arg) -> bool { + return arg == "--preset" || cmHasLiteralPrefix(arg, "--preset="); + }); if (listPresets || it != args.end()) { std::string errormsg; bool success; @@ -2583,7 +2586,10 @@ int cmCTest::Run(std::vector<std::string>& args, std::string* output) // If listing presets we don't need a presetName success = this->SetArgsFromPreset("", listPresets); } else { - if (++it != args.end()) { + if (cmHasLiteralPrefix(*it, "--preset=")) { + auto presetName = it->substr(9); + success = this->SetArgsFromPreset(presetName, listPresets); + } else if (++it != args.end()) { auto presetName = *it; success = this->SetArgsFromPreset(presetName, listPresets); } else { diff --git a/Source/cmakemain.cxx b/Source/cmakemain.cxx index cd3c955..88ba011 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." }, @@ -511,6 +511,7 @@ int do_build(int ac, char const* const* av) bool hasPreset = false; for (int i = 2; i < ac; ++i) { if (strcmp(av[i], "--list-presets") == 0 || + cmHasLiteralPrefix(av[i], "--preset=") || strcmp(av[i], "--preset") == 0) { hasPreset = true; break; @@ -584,7 +585,7 @@ int do_build(int ac, char const* const* av) "Usage: cmake --build [<dir> | --preset <preset>] [options] [-- [native-options]]\n" "Options:\n" " <dir> = Project binary directory to be built.\n" - " --preset <preset>\n" + " --preset <preset>, --preset=<preset>\n" " = Specify a build preset.\n" " --list-presets\n" " = List available build presets.\n" diff --git a/Source/ctest.cxx b/Source/ctest.cxx index 1404b0c..3c331d3 100644 --- a/Source/ctest.cxx +++ b/Source/ctest.cxx @@ -26,7 +26,8 @@ static const char* cmDocumentationUsage[][2] = { { nullptr, { nullptr, nullptr } }; static const char* cmDocumentationOptions[][2] = { - { "--preset <preset>", "Read arguments from a test preset." }, + { "--preset <preset>, --preset=<preset>", + "Read arguments from a test preset." }, { "--list-presets", "List available test presets." }, { "-C <cfg>, --build-config <cfg>", "Choose configuration to test." }, { "--progress", "Enable short progress output from tests." }, |