diff options
author | Brad King <brad.king@kitware.com> | 2006-06-15 14:12:19 (GMT) |
---|---|---|
committer | Brad King <brad.king@kitware.com> | 2006-06-15 14:12:19 (GMT) |
commit | b4542762a77c7fa7848a3ac8e85cf42c05bc73a9 (patch) | |
tree | d92cb8d28cedac5ad5a355b01fe2551badf965ef /Source/cmLocalGenerator.cxx | |
parent | 60487a227e76100ea812c0788f8499861d51ba70 (diff) | |
download | CMake-b4542762a77c7fa7848a3ac8e85cf42c05bc73a9.zip CMake-b4542762a77c7fa7848a3ac8e85cf42c05bc73a9.tar.gz CMake-b4542762a77c7fa7848a3ac8e85cf42c05bc73a9.tar.bz2 |
ENH: Added target property INSTALL_RPATH_USE_LINK_PATH to append the linker search path directories not inside the project to the INSTALL_RPATH automatically. The property is initialized by the variable CMAKE_INSTALL_RPATH_USE_LINK_PATH when the target is created.
Diffstat (limited to 'Source/cmLocalGenerator.cxx')
-rw-r--r-- | Source/cmLocalGenerator.cxx | 25 |
1 files changed, 22 insertions, 3 deletions
diff --git a/Source/cmLocalGenerator.cxx b/Source/cmLocalGenerator.cxx index 52f48ac..a73fbce 100644 --- a/Source/cmLocalGenerator.cxx +++ b/Source/cmLocalGenerator.cxx @@ -1418,6 +1418,9 @@ void cmLocalGenerator::OutputLinkLibraries(std::ostream& fout, outputRuntime && tgt.HaveInstallTreeRPATH() && linking_for_install; bool use_build_rpath = outputRuntime && tgt.HaveBuildTreeRPATH() && !linking_for_install; + bool use_link_rpath = + outputRuntime && linking_for_install && + tgt.GetPropertyAsBool("INSTALL_RPATH_USE_LINK_PATH"); // Construct the RPATH. std::vector<std::string> runtimeDirs; @@ -1454,13 +1457,29 @@ void cmLocalGenerator::OutputLinkLibraries(std::ostream& fout, && libDir->find("${") == std::string::npos) { linkLibs += libPathFlag; + linkLibs += fullLibPath; + linkLibs += " "; + + // Put this directory in the rpath if using build-tree rpath + // support or if using the link path as an rpath. if(use_build_rpath) { - runtimeDirs.push_back( fullLibPath ); + runtimeDirs.push_back(fullLibPath); + } + else if(use_link_rpath) + { + // Do not add any path inside the source or build tree. + const char* topSourceDir = this->Makefile->GetHomeDirectory(); + const char* topBinaryDir = this->Makefile->GetHomeOutputDirectory(); + if(!cmSystemTools::ComparePath(libDir->c_str(), topSourceDir) && + !cmSystemTools::ComparePath(libDir->c_str(), topBinaryDir) && + !cmSystemTools::IsSubDirectory(libDir->c_str(), topSourceDir) && + !cmSystemTools::IsSubDirectory(libDir->c_str(), topBinaryDir)) + { + runtimeDirs.push_back(fullLibPath); + } } } - linkLibs += fullLibPath; - linkLibs += " "; } } |