summaryrefslogtreecommitdiffstats
path: root/Source/cmExportFileGenerator.cxx
diff options
context:
space:
mode:
authorBrad King <brad.king@kitware.com>2008-01-31 20:45:31 (GMT)
committerBrad King <brad.king@kitware.com>2008-01-31 20:45:31 (GMT)
commit2cff26fa52cf9043f00d1efaaf31ab93e2db22e8 (patch)
tree4d403a91a70594893fc6b303a9cf693d4e538a9d /Source/cmExportFileGenerator.cxx
parent52e75800b4731692f1e311f0d8701875ac98c96d (diff)
downloadCMake-2cff26fa52cf9043f00d1efaaf31ab93e2db22e8.zip
CMake-2cff26fa52cf9043f00d1efaaf31ab93e2db22e8.tar.gz
CMake-2cff26fa52cf9043f00d1efaaf31ab93e2db22e8.tar.bz2
ENH: Support linking to shared libs with dependent libs
- Split IMPORTED_LINK_LIBRARIES into two parts: IMPORTED_LINK_INTERFACE_LIBRARIES IMPORTED_LINK_DEPENDENT_LIBRARIES - Add CMAKE_DEPENDENT_SHARED_LIBRARY_MODE to select behavior - Set mode to LINK for Darwin (fixes universal binary problem) - Update ExportImport test to account for changes
Diffstat (limited to 'Source/cmExportFileGenerator.cxx')
-rw-r--r--Source/cmExportFileGenerator.cxx31
1 files changed, 24 insertions, 7 deletions
diff --git a/Source/cmExportFileGenerator.cxx b/Source/cmExportFileGenerator.cxx
index 5c4d0f2..7b23b18 100644
--- a/Source/cmExportFileGenerator.cxx
+++ b/Source/cmExportFileGenerator.cxx
@@ -139,7 +139,12 @@ cmExportFileGenerator
target->GetLinkInterface(config))
{
// This target provides a link interface, so use it.
- this->SetImportLinkProperties(suffix, target, *interface, properties);
+ this->SetImportLinkProperty(suffix, target,
+ "IMPORTED_LINK_INTERFACE_LIBRARIES",
+ interface->Libraries, properties);
+ this->SetImportLinkProperty(suffix, target,
+ "IMPORTED_LINK_DEPENDENT_LIBRARIES",
+ interface->SharedDeps, properties);
}
else if(target->GetType() == cmTarget::STATIC_LIBRARY ||
target->GetType() == cmTarget::SHARED_LIBRARY)
@@ -183,17 +188,26 @@ cmExportFileGenerator
}
// Store the entries in the property.
- this->SetImportLinkProperties(suffix, target, actual_libs, properties);
+ this->SetImportLinkProperty(suffix, target,
+ "IMPORTED_LINK_INTERFACE_LIBRARIES",
+ actual_libs, properties);
}
//----------------------------------------------------------------------------
void
cmExportFileGenerator
-::SetImportLinkProperties(std::string const& suffix,
- cmTarget* target,
- std::vector<std::string> const& libs,
- ImportPropertyMap& properties)
+::SetImportLinkProperty(std::string const& suffix,
+ cmTarget* target,
+ const char* propName,
+ std::vector<std::string> const& libs,
+ ImportPropertyMap& properties)
{
+ // Skip the property if there are no libraries.
+ if(libs.empty())
+ {
+ return;
+ }
+
// Get the makefile in which to lookup target information.
cmMakefile* mf = target->GetMakefile();
@@ -233,6 +247,9 @@ cmExportFileGenerator
// known here. This is probably user-error.
this->ComplainAboutMissingTarget(target, li->c_str());
}
+ // Assume the target will be exported by another command.
+ // Append it with the export namespace.
+ link_libs += this->Namespace;
link_libs += *li;
}
}
@@ -244,7 +261,7 @@ cmExportFileGenerator
}
// Store the property.
- std::string prop = "IMPORTED_LINK_LIBRARIES";
+ std::string prop = propName;
prop += suffix;
properties[prop] = link_libs;
}