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/cmTarget.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/cmTarget.cxx')
-rw-r--r-- | Source/cmTarget.cxx | 60 |
1 files changed, 54 insertions, 6 deletions
diff --git a/Source/cmTarget.cxx b/Source/cmTarget.cxx index e15dcdd..68788fa 100644 --- a/Source/cmTarget.cxx +++ b/Source/cmTarget.cxx @@ -52,6 +52,7 @@ void cmTarget::SetMakefile(cmMakefile* mf) m_Makefile = mf; // Setup default property values. + this->SetPropertyDefault("INSTALL_NAME_DIR", ""); this->SetPropertyDefault("INSTALL_RPATH", ""); this->SetPropertyDefault("SKIP_BUILD_RPATH", "OFF"); this->SetPropertyDefault("BUILD_WITH_INSTALL_RPATH", "OFF"); @@ -775,7 +776,7 @@ void cmTarget::SetProperty(const char* prop, const char* value) m_Properties[prop] = value; } -const char* cmTarget::GetDirectory() +const char* cmTarget::GetDirectory(const char* config) { switch( this->GetType() ) { @@ -794,6 +795,13 @@ const char* cmTarget::GetDirectory() { m_Directory = m_Makefile->GetStartOutputDirectory(); } + if(config) + { + // Add the configuration's subdirectory. + m_Directory += "/"; + m_Makefile->GetLocalGenerator()->GetGlobalGenerator()-> + AppendDirectoryForConfig(config, m_Directory); + } return m_Directory.c_str(); } @@ -1069,13 +1077,9 @@ void cmTarget::GetFullName(std::string& prefix, std::string& base, std::string cmTarget::GetFullPath(const char* config, bool implib) { // Start with the output directory for the target. - std::string fpath = this->GetDirectory(); + std::string fpath = this->GetDirectory(config); fpath += "/"; - // Add the configuration's subdirectory. - m_Makefile->GetLocalGenerator()->GetGlobalGenerator()-> - AppendDirectoryForConfig(config, fpath); - // Add the full name of the target. fpath += this->GetFullName(config, implib); return fpath; @@ -1440,3 +1444,47 @@ bool cmTarget::NeedRelinkBeforeInstall() // this target must be relinked. return this->HaveBuildTreeRPATH() || this->HaveInstallTreeRPATH(); } + +//---------------------------------------------------------------------------- +std::string cmTarget::GetInstallNameDirForBuildTree(const char* config) +{ + // If building directly for installation then the build tree install_name + // is the same as the install tree. + if(this->GetPropertyAsBool("BUILD_WITH_INSTALL_RPATH")) + { + return GetInstallNameDirForInstallTree(config); + } + + // Use the build tree directory for the target. + if(m_Makefile->IsOn("CMAKE_PLATFORM_HAS_INSTALLNAME") && + !m_Makefile->IsOn("CMAKE_SKIP_RPATH") && + !this->GetPropertyAsBool("SKIP_BUILD_RPATH")) + { + std::string dir = this->GetDirectory(config); + dir += "/"; + return dir; + } + else + { + return ""; + } +} + +//---------------------------------------------------------------------------- +std::string cmTarget::GetInstallNameDirForInstallTree(const char*) +{ + // Lookup the target property. + const char* install_name_dir = this->GetProperty("INSTALL_NAME_DIR"); + if(m_Makefile->IsOn("CMAKE_PLATFORM_HAS_INSTALLNAME") && + !m_Makefile->IsOn("CMAKE_SKIP_RPATH") && + install_name_dir && *install_name_dir) + { + std::string dir = install_name_dir; + dir += "/"; + return dir; + } + else + { + return ""; + } +} |