summaryrefslogtreecommitdiffstats
path: root/Source/cmCTest.cxx
diff options
context:
space:
mode:
authorBrad King <brad.king@kitware.com>2021-02-23 14:12:55 (GMT)
committerBrad King <brad.king@kitware.com>2021-02-23 14:22:00 (GMT)
commit6fa36470239a40ef81752ddea923d8618ad6eb7c (patch)
treeb1a9b98b5485f9a824d5986446163883bc22b62d /Source/cmCTest.cxx
parent3357d377612fc238ff9da61666041764792034bb (diff)
downloadCMake-6fa36470239a40ef81752ddea923d8618ad6eb7c.zip
CMake-6fa36470239a40ef81752ddea923d8618ad6eb7c.tar.gz
CMake-6fa36470239a40ef81752ddea923d8618ad6eb7c.tar.bz2
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/cmCTest.cxx')
-rw-r--r--Source/cmCTest.cxx10
1 files changed, 8 insertions, 2 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 {