summaryrefslogtreecommitdiffstats
path: root/Source
diff options
context:
space:
mode:
authorBrad King <brad.king@kitware.com>2018-11-02 11:55:06 (GMT)
committerKitware Robot <kwrobot@kitware.com>2018-11-02 11:55:14 (GMT)
commit9578c3f0d18a5407a3106a6c487115947d1355e4 (patch)
treea952f14f73f305e0039e297a6aa28da7908b647e /Source
parent08da4f8d70cce97a9a6913d74e6c128ca6c0a40b (diff)
parent4babc9058a996e9cccd183eb25eda5faedd04591 (diff)
downloadCMake-9578c3f0d18a5407a3106a6c487115947d1355e4.zip
CMake-9578c3f0d18a5407a3106a6c487115947d1355e4.tar.gz
CMake-9578c3f0d18a5407a3106a6c487115947d1355e4.tar.bz2
Merge topic 'check-keywords-only-if-used'
4babc9058a cmTargetPropCommandBase: check keywords after parsing 45a49ae58a cmTargetPropCommandBase: simplify code path 9f64974f5e cmTargetPropCommandBase: skip property setting if there's nothing to add 4201a11c2b Tests: add tests for empty-value keyword arguments in target_* Acked-by: Kitware Robot <kwrobot@kitware.com> Merge-request: !2514
Diffstat (limited to 'Source')
-rw-r--r--Source/cmTargetPropCommandBase.cxx25
1 files changed, 15 insertions, 10 deletions
diff --git a/Source/cmTargetPropCommandBase.cxx b/Source/cmTargetPropCommandBase.cxx
index 9a8fd96..1b8ee81 100644
--- a/Source/cmTargetPropCommandBase.cxx
+++ b/Source/cmTargetPropCommandBase.cxx
@@ -84,15 +84,6 @@ bool cmTargetPropCommandBase::ProcessContentArgs(
this->SetError("called with invalid arguments");
return false;
}
- if (this->Target->GetType() == cmStateEnums::INTERFACE_LIBRARY &&
- scope != "INTERFACE") {
- this->SetError("may only set INTERFACE properties on INTERFACE targets");
- return false;
- }
- if (this->Target->IsImported() && scope != "INTERFACE") {
- this->SetError("may only set INTERFACE properties on IMPORTED targets");
- return false;
- }
++argIndex;
@@ -101,10 +92,21 @@ bool cmTargetPropCommandBase::ProcessContentArgs(
for (unsigned int i = argIndex; i < args.size(); ++i, ++argIndex) {
if (args[i] == "PUBLIC" || args[i] == "PRIVATE" ||
args[i] == "INTERFACE") {
- return this->PopulateTargetProperies(scope, content, prepend, system);
+ break;
}
content.push_back(args[i]);
}
+ if (!content.empty()) {
+ if (this->Target->GetType() == cmStateEnums::INTERFACE_LIBRARY &&
+ scope != "INTERFACE") {
+ this->SetError("may only set INTERFACE properties on INTERFACE targets");
+ return false;
+ }
+ if (this->Target->IsImported() && scope != "INTERFACE") {
+ this->SetError("may only set INTERFACE properties on IMPORTED targets");
+ return false;
+ }
+ }
return this->PopulateTargetProperies(scope, content, prepend, system);
}
@@ -112,6 +114,9 @@ bool cmTargetPropCommandBase::PopulateTargetProperies(
const std::string& scope, const std::vector<std::string>& content,
bool prepend, bool system)
{
+ if (content.empty()) {
+ return true;
+ }
if (scope == "PRIVATE" || scope == "PUBLIC") {
if (!this->HandleDirectContent(this->Target, content, prepend, system)) {
return false;