summaryrefslogtreecommitdiffstats
path: root/Source/cmAddTestCommand.cxx
diff options
context:
space:
mode:
authorSergey Bobrenok <bobrofon@gmail.com>2019-05-15 15:10:39 (GMT)
committerBrad King <brad.king@kitware.com>2019-06-07 17:14:29 (GMT)
commite791ffac61912f6540742aabaf4cb78a4d475a16 (patch)
treeb8aa85f7406bfc599ce113ecf32f5f0312d2db65 /Source/cmAddTestCommand.cxx
parente2414ee13d1fad8b6775581d01975109c9867854 (diff)
downloadCMake-e791ffac61912f6540742aabaf4cb78a4d475a16.zip
CMake-e791ffac61912f6540742aabaf4cb78a4d475a16.tar.gz
CMake-e791ffac61912f6540742aabaf4cb78a4d475a16.tar.bz2
add_test: Add COMMAND_EXPAND_LISTS option
Add a `COMMAND_EXPAND_LISTS` option to the `add_test` command to cause `;`-separated lists produced by generator expressions to be expanded into multiple arguments. The `add_custom_command` command already has such an option. Fixes: #17284
Diffstat (limited to 'Source/cmAddTestCommand.cxx')
-rw-r--r--Source/cmAddTestCommand.cxx9
1 files changed, 9 insertions, 0 deletions
diff --git a/Source/cmAddTestCommand.cxx b/Source/cmAddTestCommand.cxx
index bf28702..b0c462b 100644
--- a/Source/cmAddTestCommand.cxx
+++ b/Source/cmAddTestCommand.cxx
@@ -58,6 +58,7 @@ bool cmAddTestCommand::HandleNameMode(std::vector<std::string> const& args)
std::vector<std::string> configurations;
std::string working_directory;
std::vector<std::string> command;
+ bool command_expand_lists = false;
// Read the arguments.
enum Doing
@@ -88,6 +89,13 @@ bool cmAddTestCommand::HandleNameMode(std::vector<std::string> const& args)
return false;
}
doing = DoingWorkingDirectory;
+ } else if (args[i] == "COMMAND_EXPAND_LISTS") {
+ if (command_expand_lists) {
+ this->SetError(" may be given at most one COMMAND_EXPAND_LISTS.");
+ return false;
+ }
+ command_expand_lists = true;
+ doing = DoingNone;
} else if (doing == DoingName) {
name = args[i];
doing = DoingNone;
@@ -134,6 +142,7 @@ bool cmAddTestCommand::HandleNameMode(std::vector<std::string> const& args)
if (!working_directory.empty()) {
test->SetProperty("WORKING_DIRECTORY", working_directory.c_str());
}
+ test->SetCommandExpandLists(command_expand_lists);
this->Makefile->AddTestGenerator(new cmTestGenerator(test, configurations));
return true;