diff options
author | Brad King <brad.king@kitware.com> | 2021-02-23 09:12:55 -0500 |
---|---|---|
committer | Brad King <brad.king@kitware.com> | 2021-02-23 09:22:00 -0500 |
commit | 6fa36470239a40ef81752ddea923d8618ad6eb7c (patch) | |
tree | b1a9b98b5485f9a824d5986446163883bc22b62d /Source | |
parent | 3357d377612fc238ff9da61666041764792034bb (diff) | |
download | cmake-6fa36470239a40ef81752ddea923d8618ad6eb7c.tar.gz |
ctest: Add support for '--prefix=<prefix>' form of the argument
The main `cmake --preset` argument for configure presets supports both
forms, so support it for `ctest --preset` too.
Fixes: #21855
Diffstat (limited to 'Source')
-rw-r--r-- | Source/cmCTest.cxx | 10 | ||||
-rw-r--r-- | Source/ctest.cxx | 3 |
2 files changed, 10 insertions, 3 deletions
diff --git a/Source/cmCTest.cxx b/Source/cmCTest.cxx index e8d7c05eaf..620ba19798 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/ctest.cxx b/Source/ctest.cxx index 1404b0cb39..3c331d32bf 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." }, |