diff options
author | Brad King <brad.king@kitware.com> | 2006-02-24 18:13:14 (GMT) |
---|---|---|
committer | Brad King <brad.king@kitware.com> | 2006-02-24 18:13:14 (GMT) |
commit | 586a9427d3dd8b4a99f7a3d545814f8b9bf42453 (patch) | |
tree | 82f286d8b7e97066af8c623bff58840ba42c5828 /Source/cmMakefileLibraryTargetGenerator.cxx | |
parent | 7db7b981afa37cb33c131c3ba1c559bb6d15b1a5 (diff) | |
download | CMake-586a9427d3dd8b4a99f7a3d545814f8b9bf42453.zip CMake-586a9427d3dd8b4a99f7a3d545814f8b9bf42453.tar.gz CMake-586a9427d3dd8b4a99f7a3d545814f8b9bf42453.tar.bz2 |
ENH: Created target property INSTALL_NAME_DIR initalized by CMAKE_INSTALL_NAME_DIR specifying the directory portion of the OSX install_name field in shared libraries. This is the OSX equivalent of RPATH.
Diffstat (limited to 'Source/cmMakefileLibraryTargetGenerator.cxx')
-rw-r--r-- | Source/cmMakefileLibraryTargetGenerator.cxx | 41 |
1 files changed, 40 insertions, 1 deletions
diff --git a/Source/cmMakefileLibraryTargetGenerator.cxx b/Source/cmMakefileLibraryTargetGenerator.cxx index d8bc80e..a5b6154 100644 --- a/Source/cmMakefileLibraryTargetGenerator.cxx +++ b/Source/cmMakefileLibraryTargetGenerator.cxx @@ -392,7 +392,46 @@ void cmMakefileLibraryTargetGenerator::WriteLibraryRules vars.ObjectsQuoted = buildObjs.c_str(); vars.TargetSOName= targetNameSO.c_str(); vars.LinkFlags = linkFlags.c_str(); - + + // Compute the directory portion of the install_name setting. + std::string install_name_dir; + if(this->Target->GetType() == cmTarget::SHARED_LIBRARY) + { + // Select whether to generate an install_name directory for the + // install tree or the build tree. + const char* config = this->LocalGenerator->m_ConfigurationName.c_str(); + if(this->Target->GetPropertyAsBool("BUILD_WITH_INSTALL_RPATH")) + { + install_name_dir = + this->Target->GetInstallNameDirForInstallTree(config); + } + else + { + install_name_dir = + this->Target->GetInstallNameDirForBuildTree(config); + } + + // Set the rule variable replacement value. + if(install_name_dir.empty()) + { + vars.TargetInstallNameDir = ""; + } + else + { + // Convert to a path for the native build tool. + install_name_dir = + this->LocalGenerator->Convert(install_name_dir.c_str(), + cmLocalGenerator::FULL, + cmLocalGenerator::SHELL, false); + + // The Convert method seems to strip trailing slashes, which should + // probably be fixed. Since the only platform supporting install_name + // right now uses forward slashes just add one. + install_name_dir += "/"; + vars.TargetInstallNameDir = install_name_dir.c_str(); + } + } + // Expand placeholders in the commands. this->LocalGenerator->m_TargetImplib = targetOutPathImport; for(std::vector<std::string>::iterator i = commands.begin(); |