From 2e75bf672b0d8e58972f9445a0ef475d21dbe87f Mon Sep 17 00:00:00 2001 From: Brad King Date: Fri, 9 May 2014 10:04:23 -0400 Subject: [PATCH 1/4] cmTarget: Drop unused GetProperty signature No callers use the second "scope" argument. Drop this signature and hard-code the default parameter value internally. --- Source/cmTarget.cxx | 13 +++---------- Source/cmTarget.h | 1 - 2 files changed, 3 insertions(+), 11 deletions(-) diff --git a/Source/cmTarget.cxx b/Source/cmTarget.cxx index e2a568b3e..9eb1f634b 100644 --- a/Source/cmTarget.cxx +++ b/Source/cmTarget.cxx @@ -2623,12 +2623,6 @@ const char* cmTarget::GetFeature(const char* feature, const char* config) const return this->Makefile->GetFeature(feature, config); } -//---------------------------------------------------------------------------- -const char *cmTarget::GetProperty(const char* prop) const -{ - return this->GetProperty(prop, cmProperty::TARGET); -} - //---------------------------------------------------------------------------- bool cmTarget::HandleLocationPropertyPolicy() const { @@ -2667,8 +2661,7 @@ bool cmTarget::HandleLocationPropertyPolicy() const } //---------------------------------------------------------------------------- -const char *cmTarget::GetProperty(const char* prop, - cmProperty::ScopeType scope) const +const char *cmTarget::GetProperty(const char* prop) const { if(!prop) { @@ -2857,10 +2850,10 @@ const char *cmTarget::GetProperty(const char* prop, } bool chain = false; const char *retVal = - this->Properties.GetPropertyValue(prop, scope, chain); + this->Properties.GetPropertyValue(prop, cmProperty::TARGET, chain); if (chain) { - return this->Makefile->GetProperty(prop,scope); + return this->Makefile->GetProperty(prop, cmProperty::TARGET); } return retVal; } diff --git a/Source/cmTarget.h b/Source/cmTarget.h index 0e9d6824a..a23c6012e 100644 --- a/Source/cmTarget.h +++ b/Source/cmTarget.h @@ -257,7 +257,6 @@ public: void SetProperty(const char *prop, const char *value); void AppendProperty(const char* prop, const char* value,bool asString=false); const char *GetProperty(const char *prop) const; - const char *GetProperty(const char *prop, cmProperty::ScopeType scope) const; bool GetPropertyAsBool(const char *prop) const; void CheckProperty(const char* prop, cmMakefile* context) const; From 23409f50f13a337333021b458a42273464100eae Mon Sep 17 00:00:00 2001 From: Brad King Date: Fri, 9 May 2014 10:50:29 -0400 Subject: [PATCH 2/4] cmTarget: Evaluate CMP0026 in calling context This policy should be checked at the call site that tries to access the LOCATION property, not the directory scope containing the target. Thread the caller context through cmTarget::GetProperty to use for checking the policy setting and emitting a diagnostic with proper backtrace. Extend the RunCMake.CMP0026 test with a cross-directory case. --- Source/cmGetPropertyCommand.cxx | 3 ++- Source/cmGetTargetPropertyCommand.cxx | 2 +- Source/cmTarget.cxx | 21 ++++++++++++------- Source/cmTarget.h | 3 ++- .../CMP0026/CMP0026-WARN-Dir/CMakeLists.txt | 1 + .../RunCMake/CMP0026/CMP0026-WARN-stderr.txt | 13 ++++++++++++ Tests/RunCMake/CMP0026/CMP0026-WARN.cmake | 3 +++ 7 files changed, 36 insertions(+), 10 deletions(-) create mode 100644 Tests/RunCMake/CMP0026/CMP0026-WARN-Dir/CMakeLists.txt diff --git a/Source/cmGetPropertyCommand.cxx b/Source/cmGetPropertyCommand.cxx index 33c43caf6..810802a24 100644 --- a/Source/cmGetPropertyCommand.cxx +++ b/Source/cmGetPropertyCommand.cxx @@ -302,7 +302,8 @@ bool cmGetPropertyCommand::HandleTargetMode() } if(cmTarget* target = this->Makefile->FindTargetToUse(this->Name)) { - return this->StoreResult(target->GetProperty(this->PropertyName.c_str())); + return this->StoreResult(target->GetProperty(this->PropertyName.c_str(), + this->Makefile)); } else { diff --git a/Source/cmGetTargetPropertyCommand.cxx b/Source/cmGetTargetPropertyCommand.cxx index 4aa49fe9c..272607e37 100644 --- a/Source/cmGetTargetPropertyCommand.cxx +++ b/Source/cmGetTargetPropertyCommand.cxx @@ -38,7 +38,7 @@ bool cmGetTargetPropertyCommand else if(cmTarget* tgt = this->Makefile->FindTargetToUse(targetName)) { cmTarget& target = *tgt; - prop = target.GetProperty(args[2].c_str()); + prop = target.GetProperty(args[2].c_str(), this->Makefile); } else { diff --git a/Source/cmTarget.cxx b/Source/cmTarget.cxx index 9eb1f634b..219560eae 100644 --- a/Source/cmTarget.cxx +++ b/Source/cmTarget.cxx @@ -2624,7 +2624,7 @@ const char* cmTarget::GetFeature(const char* feature, const char* config) const } //---------------------------------------------------------------------------- -bool cmTarget::HandleLocationPropertyPolicy() const +bool cmTarget::HandleLocationPropertyPolicy(cmMakefile* context) const { if (this->IsImported()) { @@ -2633,7 +2633,7 @@ bool cmTarget::HandleLocationPropertyPolicy() const cmOStringStream e; const char *modal = 0; cmake::MessageType messageType = cmake::AUTHOR_WARNING; - switch (this->Makefile->GetPolicyStatus(cmPolicies::CMP0026)) + switch (context->GetPolicyStatus(cmPolicies::CMP0026)) { case cmPolicies::WARN: e << (this->Makefile->GetPolicies() @@ -2654,7 +2654,7 @@ bool cmTarget::HandleLocationPropertyPolicy() const << this->GetName() << "\". Use the target name directly with " "add_custom_command, or use the generator expression $, " "as appropriate.\n"; - this->Makefile->IssueMessage(messageType, e.str().c_str()); + context->IssueMessage(messageType, e.str().c_str()); } return messageType != cmake::FATAL_ERROR; @@ -2662,6 +2662,13 @@ bool cmTarget::HandleLocationPropertyPolicy() const //---------------------------------------------------------------------------- const char *cmTarget::GetProperty(const char* prop) const +{ + return this->GetProperty(prop, this->Makefile); +} + +//---------------------------------------------------------------------------- +const char *cmTarget::GetProperty(const char* prop, + cmMakefile* context) const { if(!prop) { @@ -2674,7 +2681,7 @@ const char *cmTarget::GetProperty(const char* prop) const cmOStringStream e; e << "INTERFACE_LIBRARY targets may only have whitelisted properties. " "The property \"" << prop << "\" is not allowed."; - this->Makefile->IssueMessage(cmake::FATAL_ERROR, e.str().c_str()); + context->IssueMessage(cmake::FATAL_ERROR, e.str().c_str()); return 0; } @@ -2693,7 +2700,7 @@ const char *cmTarget::GetProperty(const char* prop) const { if(strcmp(prop,"LOCATION") == 0) { - if (!this->HandleLocationPropertyPolicy()) + if (!this->HandleLocationPropertyPolicy(context)) { return 0; } @@ -2714,7 +2721,7 @@ const char *cmTarget::GetProperty(const char* prop) const // Support "LOCATION_". if(cmHasLiteralPrefix(prop, "LOCATION_")) { - if (!this->HandleLocationPropertyPolicy()) + if (!this->HandleLocationPropertyPolicy(context)) { return 0; } @@ -2729,7 +2736,7 @@ const char *cmTarget::GetProperty(const char* prop) const std::string configName(prop, strlen(prop) - 9); if(configName != "IMPORTED") { - if (!this->HandleLocationPropertyPolicy()) + if (!this->HandleLocationPropertyPolicy(context)) { return 0; } diff --git a/Source/cmTarget.h b/Source/cmTarget.h index a23c6012e..a305caaa8 100644 --- a/Source/cmTarget.h +++ b/Source/cmTarget.h @@ -257,6 +257,7 @@ public: void SetProperty(const char *prop, const char *value); void AppendProperty(const char* prop, const char* value,bool asString=false); const char *GetProperty(const char *prop) const; + const char *GetProperty(const char *prop, cmMakefile* context) const; bool GetPropertyAsBool(const char *prop) const; void CheckProperty(const char* prop, cmMakefile* context) const; @@ -579,7 +580,7 @@ public: const std::string &compatibilityType) const; private: - bool HandleLocationPropertyPolicy() const; + bool HandleLocationPropertyPolicy(cmMakefile* context) const; // The set of include directories that are marked as system include // directories. diff --git a/Tests/RunCMake/CMP0026/CMP0026-WARN-Dir/CMakeLists.txt b/Tests/RunCMake/CMP0026/CMP0026-WARN-Dir/CMakeLists.txt new file mode 100644 index 000000000..17a7db043 --- /dev/null +++ b/Tests/RunCMake/CMP0026/CMP0026-WARN-Dir/CMakeLists.txt @@ -0,0 +1 @@ +add_library(otherlib ../empty.cpp) diff --git a/Tests/RunCMake/CMP0026/CMP0026-WARN-stderr.txt b/Tests/RunCMake/CMP0026/CMP0026-WARN-stderr.txt index 9b8819488..d122c4a2e 100644 --- a/Tests/RunCMake/CMP0026/CMP0026-WARN-stderr.txt +++ b/Tests/RunCMake/CMP0026/CMP0026-WARN-stderr.txt @@ -10,3 +10,16 @@ CMake Warning \(dev\) at CMP0026-WARN.cmake:5 \(get_target_property\): Call Stack \(most recent call first\): CMakeLists.txt:3 \(include\) This warning is for project developers. Use -Wno-dev to suppress it. ++ +CMake Warning \(dev\) at CMP0026-WARN.cmake:8 \(get_target_property\): + Policy CMP0026 is not set: Disallow use of the LOCATION target property. + Run "cmake --help-policy CMP0026" for policy details. Use the cmake_policy + command to set the policy and suppress this warning. + + The LOCATION property should not be read from target "otherlib". Use the + target name directly with add_custom_command, or use the generator + expression \$, as appropriate. + +Call Stack \(most recent call first\): + CMakeLists.txt:3 \(include\) +This warning is for project developers. Use -Wno-dev to suppress it. diff --git a/Tests/RunCMake/CMP0026/CMP0026-WARN.cmake b/Tests/RunCMake/CMP0026/CMP0026-WARN.cmake index 89c5a8af7..bfc9203af 100644 --- a/Tests/RunCMake/CMP0026/CMP0026-WARN.cmake +++ b/Tests/RunCMake/CMP0026/CMP0026-WARN.cmake @@ -3,3 +3,6 @@ enable_language(CXX) add_library(somelib empty.cpp) get_target_property(_loc somelib LOCATION) + +add_subdirectory(CMP0026-WARN-Dir) +get_target_property(_loc otherlib LOCATION) From cb810abe6d1c4189517d84fa6e08849a02e3f873 Mon Sep 17 00:00:00 2001 From: Brad King Date: Fri, 9 May 2014 10:04:23 -0400 Subject: [PATCH 3/4] cmTarget: Drop unused GetProperty signature No callers use the second "scope" argument. Drop this signature and hard-code the default parameter value internally. --- Source/cmTarget.cxx | 13 +++---------- Source/cmTarget.h | 2 -- 2 files changed, 3 insertions(+), 12 deletions(-) diff --git a/Source/cmTarget.cxx b/Source/cmTarget.cxx index dda855f26..6b8d51d97 100644 --- a/Source/cmTarget.cxx +++ b/Source/cmTarget.cxx @@ -3177,12 +3177,6 @@ const char* cmTarget::GetFeature(const std::string& feature, return this->Makefile->GetFeature(feature, config); } -//---------------------------------------------------------------------------- -const char *cmTarget::GetProperty(const std::string& prop) const -{ - return this->GetProperty(prop, cmProperty::TARGET); -} - //---------------------------------------------------------------------------- bool cmTarget::HandleLocationPropertyPolicy() const { @@ -3221,8 +3215,7 @@ bool cmTarget::HandleLocationPropertyPolicy() const } //---------------------------------------------------------------------------- -const char *cmTarget::GetProperty(const std::string& prop, - cmProperty::ScopeType scope) const +const char *cmTarget::GetProperty(const std::string& prop) const { if (this->GetType() == INTERFACE_LIBRARY && !whiteListedInterfaceProperty(prop)) @@ -3489,10 +3482,10 @@ const char *cmTarget::GetProperty(const std::string& prop, } bool chain = false; const char *retVal = - this->Properties.GetPropertyValue(prop, scope, chain); + this->Properties.GetPropertyValue(prop, cmProperty::TARGET, chain); if (chain) { - return this->Makefile->GetProperty(prop,scope); + return this->Makefile->GetProperty(prop, cmProperty::TARGET); } return retVal; } diff --git a/Source/cmTarget.h b/Source/cmTarget.h index 4d8022e68..22462b90e 100644 --- a/Source/cmTarget.h +++ b/Source/cmTarget.h @@ -231,8 +231,6 @@ public: void AppendProperty(const std::string& prop, const char* value, bool asString=false); const char *GetProperty(const std::string& prop) const; - const char *GetProperty(const std::string& prop, - cmProperty::ScopeType scope) const; bool GetPropertyAsBool(const std::string& prop) const; void CheckProperty(const std::string& prop, cmMakefile* context) const; From 911cc9a39e1f26344d47743885626060c2d94d2c Mon Sep 17 00:00:00 2001 From: Brad King Date: Fri, 9 May 2014 10:50:29 -0400 Subject: [PATCH 4/4] cmTarget: Evaluate CMP0026 and CMP0051 in calling context These policies should be checked at the call site that tries to access the LOCATION or SOURCES property, not the directory scope containing the target. Thread the caller context through cmTarget::GetProperty to use for checking the policy setting and emitting a diagnostic with proper backtrace. Extend the RunCMake.CMP0026 and RunCMake.CMP0051 tests with cross-directory cases. --- Source/cmGetPropertyCommand.cxx | 3 ++- Source/cmGetTargetPropertyCommand.cxx | 2 +- Source/cmTarget.cxx | 25 ++++++++++++------- Source/cmTarget.h | 3 ++- .../CMP0026/CMP0026-WARN-Dir/CMakeLists.txt | 1 + .../RunCMake/CMP0026/CMP0026-WARN-stderr.txt | 13 ++++++++++ Tests/RunCMake/CMP0026/CMP0026-WARN.cmake | 3 +++ .../CMP0051/CMP0051-WARN-Dir/CMakeLists.txt | 1 + .../RunCMake/CMP0051/CMP0051-WARN-stderr.txt | 18 ++++++++++++- Tests/RunCMake/CMP0051/CMP0051-WARN.cmake | 6 +++++ 10 files changed, 62 insertions(+), 13 deletions(-) create mode 100644 Tests/RunCMake/CMP0026/CMP0026-WARN-Dir/CMakeLists.txt create mode 100644 Tests/RunCMake/CMP0051/CMP0051-WARN-Dir/CMakeLists.txt diff --git a/Source/cmGetPropertyCommand.cxx b/Source/cmGetPropertyCommand.cxx index 6dd40c921..512d78994 100644 --- a/Source/cmGetPropertyCommand.cxx +++ b/Source/cmGetPropertyCommand.cxx @@ -302,7 +302,8 @@ bool cmGetPropertyCommand::HandleTargetMode() } if(cmTarget* target = this->Makefile->FindTargetToUse(this->Name)) { - return this->StoreResult(target->GetProperty(this->PropertyName)); + return this->StoreResult(target->GetProperty(this->PropertyName, + this->Makefile)); } else { diff --git a/Source/cmGetTargetPropertyCommand.cxx b/Source/cmGetTargetPropertyCommand.cxx index e3ec0bcd3..aa6f0c11c 100644 --- a/Source/cmGetTargetPropertyCommand.cxx +++ b/Source/cmGetTargetPropertyCommand.cxx @@ -38,7 +38,7 @@ bool cmGetTargetPropertyCommand else if(cmTarget* tgt = this->Makefile->FindTargetToUse(targetName)) { cmTarget& target = *tgt; - const char* prop_cstr = target.GetProperty(args[2]); + const char* prop_cstr = target.GetProperty(args[2], this->Makefile); if(prop_cstr) { prop = prop_cstr; diff --git a/Source/cmTarget.cxx b/Source/cmTarget.cxx index 6b8d51d97..3f2ae9e27 100644 --- a/Source/cmTarget.cxx +++ b/Source/cmTarget.cxx @@ -3178,7 +3178,7 @@ const char* cmTarget::GetFeature(const std::string& feature, } //---------------------------------------------------------------------------- -bool cmTarget::HandleLocationPropertyPolicy() const +bool cmTarget::HandleLocationPropertyPolicy(cmMakefile* context) const { if (this->IsImported()) { @@ -3187,7 +3187,7 @@ bool cmTarget::HandleLocationPropertyPolicy() const cmOStringStream e; const char *modal = 0; cmake::MessageType messageType = cmake::AUTHOR_WARNING; - switch (this->Makefile->GetPolicyStatus(cmPolicies::CMP0026)) + switch (context->GetPolicyStatus(cmPolicies::CMP0026)) { case cmPolicies::WARN: e << (this->Makefile->GetPolicies() @@ -3208,7 +3208,7 @@ bool cmTarget::HandleLocationPropertyPolicy() const << this->GetName() << "\". Use the target name directly with " "add_custom_command, or use the generator expression $, " "as appropriate.\n"; - this->Makefile->IssueMessage(messageType, e.str()); + context->IssueMessage(messageType, e.str()); } return messageType != cmake::FATAL_ERROR; @@ -3216,6 +3216,13 @@ bool cmTarget::HandleLocationPropertyPolicy() const //---------------------------------------------------------------------------- const char *cmTarget::GetProperty(const std::string& prop) const +{ + return this->GetProperty(prop, this->Makefile); +} + +//---------------------------------------------------------------------------- +const char *cmTarget::GetProperty(const std::string& prop, + cmMakefile* context) const { if (this->GetType() == INTERFACE_LIBRARY && !whiteListedInterfaceProperty(prop)) @@ -3223,7 +3230,7 @@ const char *cmTarget::GetProperty(const std::string& prop) const cmOStringStream e; e << "INTERFACE_LIBRARY targets may only have whitelisted properties. " "The property \"" << prop << "\" is not allowed."; - this->Makefile->IssueMessage(cmake::FATAL_ERROR, e.str()); + context->IssueMessage(cmake::FATAL_ERROR, e.str()); return 0; } @@ -3242,7 +3249,7 @@ const char *cmTarget::GetProperty(const std::string& prop) const { if(prop == "LOCATION") { - if (!this->HandleLocationPropertyPolicy()) + if (!this->HandleLocationPropertyPolicy(context)) { return 0; } @@ -3263,7 +3270,7 @@ const char *cmTarget::GetProperty(const std::string& prop) const // Support "LOCATION_". if(cmHasLiteralPrefix(prop, "LOCATION_")) { - if (!this->HandleLocationPropertyPolicy()) + if (!this->HandleLocationPropertyPolicy(context)) { return 0; } @@ -3278,7 +3285,7 @@ const char *cmTarget::GetProperty(const std::string& prop) const std::string configName(prop.c_str(), prop.size() - 9); if(configName != "IMPORTED") { - if (!this->HandleLocationPropertyPolicy()) + if (!this->HandleLocationPropertyPolicy(context)) { return 0; } @@ -3416,7 +3423,7 @@ const char *cmTarget::GetProperty(const std::string& prop) const bool noMessage = true; cmOStringStream e; cmake::MessageType messageType = cmake::AUTHOR_WARNING; - switch(this->Makefile->GetPolicyStatus(cmPolicies::CMP0051)) + switch(context->GetPolicyStatus(cmPolicies::CMP0051)) { case cmPolicies::WARN: e << (this->Makefile->GetPolicies() @@ -3437,7 +3444,7 @@ const char *cmTarget::GetProperty(const std::string& prop) const "read at configure time. Code reading that property needs to be " "adapted to ignore the generator expression using the " "string(GENEX_STRIP) command."; - this->Makefile->IssueMessage(messageType, e.str()); + context->IssueMessage(messageType, e.str()); } if (addContent) { diff --git a/Source/cmTarget.h b/Source/cmTarget.h index 22462b90e..bee6b3491 100644 --- a/Source/cmTarget.h +++ b/Source/cmTarget.h @@ -231,6 +231,7 @@ public: void AppendProperty(const std::string& prop, const char* value, bool asString=false); const char *GetProperty(const std::string& prop) const; + const char *GetProperty(const std::string& prop, cmMakefile* context) const; bool GetPropertyAsBool(const std::string& prop) const; void CheckProperty(const std::string& prop, cmMakefile* context) const; @@ -587,7 +588,7 @@ public: const std::string &compatibilityType) const; private: - bool HandleLocationPropertyPolicy() const; + bool HandleLocationPropertyPolicy(cmMakefile* context) const; // The set of include directories that are marked as system include // directories. diff --git a/Tests/RunCMake/CMP0026/CMP0026-WARN-Dir/CMakeLists.txt b/Tests/RunCMake/CMP0026/CMP0026-WARN-Dir/CMakeLists.txt new file mode 100644 index 000000000..17a7db043 --- /dev/null +++ b/Tests/RunCMake/CMP0026/CMP0026-WARN-Dir/CMakeLists.txt @@ -0,0 +1 @@ +add_library(otherlib ../empty.cpp) diff --git a/Tests/RunCMake/CMP0026/CMP0026-WARN-stderr.txt b/Tests/RunCMake/CMP0026/CMP0026-WARN-stderr.txt index 9b8819488..d122c4a2e 100644 --- a/Tests/RunCMake/CMP0026/CMP0026-WARN-stderr.txt +++ b/Tests/RunCMake/CMP0026/CMP0026-WARN-stderr.txt @@ -10,3 +10,16 @@ CMake Warning \(dev\) at CMP0026-WARN.cmake:5 \(get_target_property\): Call Stack \(most recent call first\): CMakeLists.txt:3 \(include\) This warning is for project developers. Use -Wno-dev to suppress it. ++ +CMake Warning \(dev\) at CMP0026-WARN.cmake:8 \(get_target_property\): + Policy CMP0026 is not set: Disallow use of the LOCATION target property. + Run "cmake --help-policy CMP0026" for policy details. Use the cmake_policy + command to set the policy and suppress this warning. + + The LOCATION property should not be read from target "otherlib". Use the + target name directly with add_custom_command, or use the generator + expression \$, as appropriate. + +Call Stack \(most recent call first\): + CMakeLists.txt:3 \(include\) +This warning is for project developers. Use -Wno-dev to suppress it. diff --git a/Tests/RunCMake/CMP0026/CMP0026-WARN.cmake b/Tests/RunCMake/CMP0026/CMP0026-WARN.cmake index 89c5a8af7..bfc9203af 100644 --- a/Tests/RunCMake/CMP0026/CMP0026-WARN.cmake +++ b/Tests/RunCMake/CMP0026/CMP0026-WARN.cmake @@ -3,3 +3,6 @@ enable_language(CXX) add_library(somelib empty.cpp) get_target_property(_loc somelib LOCATION) + +add_subdirectory(CMP0026-WARN-Dir) +get_target_property(_loc otherlib LOCATION) diff --git a/Tests/RunCMake/CMP0051/CMP0051-WARN-Dir/CMakeLists.txt b/Tests/RunCMake/CMP0051/CMP0051-WARN-Dir/CMakeLists.txt new file mode 100644 index 000000000..77cbad53e --- /dev/null +++ b/Tests/RunCMake/CMP0051/CMP0051-WARN-Dir/CMakeLists.txt @@ -0,0 +1 @@ +add_library(empty2 ../empty.cpp $) diff --git a/Tests/RunCMake/CMP0051/CMP0051-WARN-stderr.txt b/Tests/RunCMake/CMP0051/CMP0051-WARN-stderr.txt index f1b0357c9..ae2e46848 100644 --- a/Tests/RunCMake/CMP0051/CMP0051-WARN-stderr.txt +++ b/Tests/RunCMake/CMP0051/CMP0051-WARN-stderr.txt @@ -12,4 +12,20 @@ Call Stack \(most recent call first\): CMakeLists.txt:3 \(include\) This warning is for project developers. Use -Wno-dev to suppress it. -Sources: "empty.cpp"$ +Sources: "empty.cpp" +* +CMake Warning \(dev\) at CMP0051-WARN.cmake:12 \(get_target_property\): + Policy CMP0051 is not set: List TARGET_OBJECTS in SOURCES target property. + Run "cmake --help-policy CMP0051" for policy details. Use the cmake_policy + command to set the policy and suppress this warning. + + Target "empty2" contains \$ generator expression in its + sources list. This content was not previously part of the SOURCES property + when that property was read at configure time. Code reading that property + needs to be adapted to ignore the generator expression using the + string\(GENEX_STRIP\) command. +Call Stack \(most recent call first\): + CMakeLists.txt:3 \(include\) +This warning is for project developers. Use -Wno-dev to suppress it. + +Sources: "../empty.cpp"$ diff --git a/Tests/RunCMake/CMP0051/CMP0051-WARN.cmake b/Tests/RunCMake/CMP0051/CMP0051-WARN.cmake index fd595cec2..744598fcb 100644 --- a/Tests/RunCMake/CMP0051/CMP0051-WARN.cmake +++ b/Tests/RunCMake/CMP0051/CMP0051-WARN.cmake @@ -6,3 +6,9 @@ add_library(empty empty.cpp $) get_target_property(srcs empty SOURCES) message("Sources: \"${srcs}\"") + +add_subdirectory(CMP0051-WARN-Dir) + +get_target_property(srcs empty2 SOURCES) + +message("Sources: \"${srcs}\"")