[cmake-commits] king committed cmComputeLinkInformation.cxx 1.11 1.12
cmComputeLinkInformation.h 1.7 1.8 cmInstallTargetGenerator.cxx
1.54 1.55
cmake-commits at cmake.org
cmake-commits at cmake.org
Tue Jan 29 15:47:20 EST 2008
Update of /cvsroot/CMake/CMake/Source
In directory public:/mounts/ram/cvs-serv29396/Source
Modified Files:
cmComputeLinkInformation.cxx cmComputeLinkInformation.h
cmInstallTargetGenerator.cxx
Log Message:
ENH: Update cmInstallTargetGenerator to get the shared libraries linked by a target from cmComputeLinkInformation instead of duplicating the computation.
Index: cmComputeLinkInformation.cxx
===================================================================
RCS file: /cvsroot/CMake/CMake/Source/cmComputeLinkInformation.cxx,v
retrieving revision 1.11
retrieving revision 1.12
diff -u -d -r1.11 -r1.12
--- cmComputeLinkInformation.cxx 29 Jan 2008 20:07:33 -0000 1.11
+++ cmComputeLinkInformation.cxx 29 Jan 2008 20:47:18 -0000 1.12
@@ -284,6 +284,13 @@
}
//----------------------------------------------------------------------------
+std::set<cmTarget*> const&
+cmComputeLinkInformation::GetSharedLibrariesLinked()
+{
+ return this->SharedLibrariesLinked;
+}
+
+//----------------------------------------------------------------------------
bool cmComputeLinkInformation::Compute()
{
// Skip targets that do not link.
@@ -340,6 +347,12 @@
return;
}
+ // Keep track of shared libraries linked.
+ if(tgt && tgt->GetType() == cmTarget::SHARED_LIBRARY)
+ {
+ this->SharedLibrariesLinked.insert(tgt);
+ }
+
if(tgt && (tgt->GetType() == cmTarget::STATIC_LIBRARY ||
tgt->GetType() == cmTarget::SHARED_LIBRARY ||
tgt->GetType() == cmTarget::MODULE_LIBRARY ||
Index: cmInstallTargetGenerator.cxx
===================================================================
RCS file: /cvsroot/CMake/CMake/Source/cmInstallTargetGenerator.cxx,v
retrieving revision 1.54
retrieving revision 1.55
diff -u -d -r1.54 -r1.55
--- cmInstallTargetGenerator.cxx 29 Jan 2008 20:07:33 -0000 1.54
+++ cmInstallTargetGenerator.cxx 29 Jan 2008 20:47:18 -0000 1.55
@@ -382,56 +382,37 @@
// Build a map of build-tree install_name to install-tree install_name for
// shared libraries linked to this target.
std::map<cmStdString, cmStdString> install_name_remap;
- cmTarget::LinkLibraryType linkType = cmTarget::OPTIMIZED;
- if(config && cmSystemTools::UpperCase(config) == "DEBUG")
- {
- linkType = cmTarget::DEBUG;
- }
- // TODO: Merge with ComputeLinkInformation.
- const cmTarget::LinkLibraryVectorType& inLibs =
- this->Target->GetLinkLibraries();
- for(cmTarget::LinkLibraryVectorType::const_iterator j = inLibs.begin();
- j != inLibs.end(); ++j)
+ if(cmComputeLinkInformation* cli = this->Target->GetLinkInformation(config))
{
- std::string lib = j->first;
- if((this->Target->GetType() == cmTarget::EXECUTABLE ||
- lib != this->Target->GetName()) &&
- (j->second == cmTarget::GENERAL || j->second == linkType))
+ std::set<cmTarget*> const& sharedLibs = cli->GetSharedLibrariesLinked();
+ for(std::set<cmTarget*>::const_iterator j = sharedLibs.begin();
+ j != sharedLibs.end(); ++j)
{
- if(cmTarget* tgt = this->Target->GetMakefile()->
- GetLocalGenerator()->GetGlobalGenerator()->
- FindTarget(0, lib.c_str()))
- {
- if(tgt->GetType() == cmTarget::SHARED_LIBRARY)
- {
- // If the build tree and install tree use different path
- // components of the install_name field then we need to create a
- // mapping to be applied after installation.
- std::string for_build = tgt->GetInstallNameDirForBuildTree(config);
- std::string for_install =
- tgt->GetInstallNameDirForInstallTree(config);
- std::string fname =
- this->GetInstallFilename(tgt, config, false, true);
+ // If the build tree and install tree use different path
+ // components of the install_name field then we need to create a
+ // mapping to be applied after installation.
+ cmTarget* tgt = *j;
+ std::string for_build = tgt->GetInstallNameDirForBuildTree(config);
+ std::string for_install = tgt->GetInstallNameDirForInstallTree(config);
+ std::string fname = this->GetInstallFilename(tgt, config, false, true);
- // Map from the build-tree install_name.
- for_build += fname;
+ // Map from the build-tree install_name.
+ for_build += fname;
- // Map to the install-tree install_name.
- if (!for_install.empty())
- {
- for_install += fname;
- }
- else
- {
- for_install = tgt->GetInstallNameFixupPath();
- }
+ // Map to the install-tree install_name.
+ if (!for_install.empty())
+ {
+ for_install += fname;
+ }
+ else
+ {
+ for_install = tgt->GetInstallNameFixupPath();
+ }
- if(for_build != for_install)
- {
- // Store the mapping entry.
- install_name_remap[for_build] = for_install;
- }
- }
+ if(for_build != for_install)
+ {
+ // Store the mapping entry.
+ install_name_remap[for_build] = for_install;
}
}
}
Index: cmComputeLinkInformation.h
===================================================================
RCS file: /cvsroot/CMake/CMake/Source/cmComputeLinkInformation.h,v
retrieving revision 1.7
retrieving revision 1.8
diff -u -d -r1.7 -r1.8
--- cmComputeLinkInformation.h 29 Jan 2008 20:07:33 -0000 1.7
+++ cmComputeLinkInformation.h 29 Jan 2008 20:47:18 -0000 1.8
@@ -56,6 +56,7 @@
std::string GetRPathString(bool for_install);
std::string GetChrpathString();
std::string GetChrpathTool();
+ std::set<cmTarget*> const& GetSharedLibrariesLinked();
private:
void AddItem(std::string const& item, cmTarget* tgt);
@@ -65,6 +66,7 @@
std::vector<std::string> Depends;
std::vector<std::string> FrameworkPaths;
std::vector<std::string> RuntimeSearchPath;
+ std::set<cmTarget*> SharedLibrariesLinked;
// Context information.
cmTarget* Target;
More information about the Cmake-commits
mailing list