summaryrefslogtreecommitdiff
path: root/Source/cmTargetLinkLibrariesCommand.cxx
diff options
context:
space:
mode:
authorStephen Kelly <steveire@gmail.com>2013-10-20 20:39:16 +0200
committerBrad King <brad.king@kitware.com>2013-10-26 10:10:20 -0400
commit239b0c6b0ed821fd012a2a980961b9a9d43793e5 (patch)
tree7b571325a3cb0112bf4965b5edd900dd0c7525c6 /Source/cmTargetLinkLibrariesCommand.cxx
parentc515dc574879448d66e2c5a27b9807d95a27fefd (diff)
downloadcmake-239b0c6b0ed821fd012a2a980961b9a9d43793e5.tar.gz
Don't add invalid content to static lib INTERFACE_LINK_LIBRARIES.
Only valid target names or generator expressions may appear in the target field of a LINK_ONLY expression. Other content like link flags should still be added to that property (wrapped in config-specific generator expressions), but not wrapped in LINK_ONLY. Otherwise undue warnings would be issued for the policy CMP0022. The LINK_ONLY expression only has an effect for actual target names anyway, so there is no logical deficit.
Diffstat (limited to 'Source/cmTargetLinkLibrariesCommand.cxx')
-rw-r--r--Source/cmTargetLinkLibrariesCommand.cxx11
1 files changed, 8 insertions, 3 deletions
diff --git a/Source/cmTargetLinkLibrariesCommand.cxx b/Source/cmTargetLinkLibrariesCommand.cxx
index 863b3917eb..6030a44a4e 100644
--- a/Source/cmTargetLinkLibrariesCommand.cxx
+++ b/Source/cmTargetLinkLibrariesCommand.cxx
@@ -384,10 +384,15 @@ cmTargetLinkLibrariesCommand::HandleLibrary(const char* lib,
{
if (this->Target->GetType() == cmTarget::STATIC_LIBRARY)
{
+ std::string configLib = this->Target
+ ->GetDebugGeneratorExpressions(lib, llt);
+ if (cmGeneratorExpression::IsValidTargetName(lib)
+ || cmGeneratorExpression::Find(lib) != std::string::npos)
+ {
+ configLib = "$<LINK_ONLY:" + configLib + ">";
+ }
this->Target->AppendProperty("INTERFACE_LINK_LIBRARIES",
- ("$<LINK_ONLY:" +
- this->Target->GetDebugGeneratorExpressions(lib, llt) +
- ">").c_str());
+ configLib.c_str());
}
// Not a 'public' or 'interface' library. Do not add to interface
// property.