summaryrefslogtreecommitdiffstats
path: root/Source/cmComputeLinkInformation.cxx
diff options
context:
space:
mode:
authorBrad King <brad.king@kitware.com>2016-11-03 20:44:32 (GMT)
committerBrad King <brad.king@kitware.com>2016-11-09 14:45:14 (GMT)
commit09cda9d5e7bb31f05177bdaf11d24aeaf85a8dd3 (patch)
treea755fd6424b16a66b008c998e108e7c1b43b64df /Source/cmComputeLinkInformation.cxx
parent1d1f1eeb6a52d464d476eb0a46eb75c452e3dfbc (diff)
downloadCMake-09cda9d5e7bb31f05177bdaf11d24aeaf85a8dd3.zip
CMake-09cda9d5e7bb31f05177bdaf11d24aeaf85a8dd3.tar.gz
CMake-09cda9d5e7bb31f05177bdaf11d24aeaf85a8dd3.tar.bz2
Allow imported INTERFACE libraries to specify a link library name
Add an `IMPORTED_LIBNAME[_<CONFIG>]` target property to specify a library name to be placed on the link line in place of an interface library since it has no library file of its own. Restrict use of the property to imported `INTERFACE` libraries. This will be particularly useful for find modules that need to provide imported libraries from system SDKs where the full path to the library file is not known. Now such find modules will be able to provide an imported interface library and set `IMPORTED_LIBNAME` to refer to the SDK library by name. Issue: #15267
Diffstat (limited to 'Source/cmComputeLinkInformation.cxx')
-rw-r--r--Source/cmComputeLinkInformation.cxx6
1 files changed, 6 insertions, 0 deletions
diff --git a/Source/cmComputeLinkInformation.cxx b/Source/cmComputeLinkInformation.cxx
index 28aa533..80e7e7d 100644
--- a/Source/cmComputeLinkInformation.cxx
+++ b/Source/cmComputeLinkInformation.cxx
@@ -606,6 +606,12 @@ void cmComputeLinkInformation::AddItem(std::string const& item,
// of COMPATIBLE_INTERFACE_ enforcement. The generators will ignore
// this for the actual link line.
this->Items.push_back(Item(std::string(), false, tgt));
+
+ // Also add the item the interface specifies to be used in its place.
+ std::string const& libName = tgt->GetImportedLibName(config);
+ if (!libName.empty()) {
+ this->AddItem(libName, CM_NULLPTR);
+ }
} else {
// Decide whether to use an import library.
bool implib =