summaryrefslogtreecommitdiffstats
path: root/Source/cmTargetLinkLibrariesCommand.cxx
diff options
context:
space:
mode:
authorBrad King <brad.king@kitware.com>2016-01-15 15:02:52 (GMT)
committerBrad King <brad.king@kitware.com>2016-01-15 15:18:53 (GMT)
commitaea1b03617bed037bbd12af36d7ef92feff0ba74 (patch)
tree818a548be8f6d180879ddb2b1c83a126fec55707 /Source/cmTargetLinkLibrariesCommand.cxx
parente5cbec14a5aec9203bd0e29fa0172fa00c97e521 (diff)
downloadCMake-aea1b03617bed037bbd12af36d7ef92feff0ba74.zip
CMake-aea1b03617bed037bbd12af36d7ef92feff0ba74.tar.gz
CMake-aea1b03617bed037bbd12af36d7ef92feff0ba74.tar.bz2
Fix export of STATIC library PRIVATE dependencies with CMP0022 NEW
The target_link_libraries command records the PRIVATE dependencies of a STATIC library in INTERFACE_LINK_LIBRARIES as "$<LINK_ONLY:dep>". This hides the target name from export namespacing logic inside a generator expression. When user-written generator expressions reference a target name they must put it inside a "$<TARGET_NAME:dep>" expression to allow the export logic to rename the target. In the case that the private dependency is not already a generator expression, target_link_libraries must use "$<LINK_ONLY:$<TARGET_NAME:dep>>" to allow the export logic to rename the target. Reported-by: Tamás Kenéz <tamas.kenez@gmail.com>
Diffstat (limited to 'Source/cmTargetLinkLibrariesCommand.cxx')
-rw-r--r--Source/cmTargetLinkLibrariesCommand.cxx7
1 files changed, 5 insertions, 2 deletions
diff --git a/Source/cmTargetLinkLibrariesCommand.cxx b/Source/cmTargetLinkLibrariesCommand.cxx
index 435346a..5f3246a 100644
--- a/Source/cmTargetLinkLibrariesCommand.cxx
+++ b/Source/cmTargetLinkLibrariesCommand.cxx
@@ -432,8 +432,11 @@ cmTargetLinkLibrariesCommand::HandleLibrary(const std::string& lib,
{
std::string configLib = this->Target
->GetDebugGeneratorExpressions(lib, llt);
- if (cmGeneratorExpression::IsValidTargetName(lib)
- || cmGeneratorExpression::Find(lib) != std::string::npos)
+ if (cmGeneratorExpression::IsValidTargetName(configLib))
+ {
+ configLib = "$<LINK_ONLY:$<TARGET_NAME:" + configLib + ">>";
+ }
+ else if (cmGeneratorExpression::Find(configLib) != std::string::npos)
{
configLib = "$<LINK_ONLY:" + configLib + ">";
}