summaryrefslogtreecommitdiffstats
path: root/Source/cmTestGenerator.cxx
diff options
context:
space:
mode:
Diffstat (limited to 'Source/cmTestGenerator.cxx')
-rw-r--r--Source/cmTestGenerator.cxx27
1 files changed, 24 insertions, 3 deletions
diff --git a/Source/cmTestGenerator.cxx b/Source/cmTestGenerator.cxx
index 840d8cf..ffb5e21 100644
--- a/Source/cmTestGenerator.cxx
+++ b/Source/cmTestGenerator.cxx
@@ -174,15 +174,36 @@ void cmTestGenerator::GenerateScriptForConfig(std::ostream& os,
if (!cmNonempty(launcher)) {
return;
}
- cmList launcherWithArgs{ ge.Parse(*launcher)->Evaluate(this->LG,
- config) };
+ const auto propVal = ge.Parse(*launcher)->Evaluate(this->LG, config);
+ cmList launcherWithArgs(propVal, cmList::ExpandElements::Yes,
+ this->Test->GetCMP0178() == cmPolicies::NEW
+ ? cmList::EmptyElements::Yes
+ : cmList::EmptyElements::No);
if (!launcherWithArgs.empty() && !launcherWithArgs[0].empty()) {
+ if (this->Test->GetCMP0178() == cmPolicies::WARN) {
+ cmList argsWithEmptyValuesPreserved(
+ propVal, cmList::ExpandElements::Yes, cmList::EmptyElements::Yes);
+ if (launcherWithArgs != argsWithEmptyValuesPreserved) {
+ this->Test->GetMakefile()->IssueMessage(
+ MessageType::AUTHOR_WARNING,
+ cmStrCat("The ", propertyName, " property of target '",
+ target->GetName(),
+ "' contains empty list items. Those empty items are "
+ "being silently discarded to preserve backward "
+ "compatibility.\n",
+ cmPolicies::GetPolicyWarning(cmPolicies::CMP0178)));
+ }
+ }
std::string launcherExe(launcherWithArgs[0]);
cmSystemTools::ConvertToUnixSlashes(launcherExe);
os << cmOutputConverter::EscapeForCMake(launcherExe) << " ";
for (std::string const& arg :
cmMakeRange(launcherWithArgs).advance(1)) {
- os << cmOutputConverter::EscapeForCMake(arg) << " ";
+ if (arg.empty()) {
+ os << "\"\" ";
+ } else {
+ os << cmOutputConverter::EscapeForCMake(arg) << " ";
+ }
}
}
};