From b47807fc15a35c1f9f53842b17ec283c2d3a7778 Mon Sep 17 00:00:00 2001 From: Alexander Neundorf Date: Thu, 17 May 2007 17:21:52 -0400 Subject: STYLE: fix indentation ENH: add hack to make new cmake work with older existing cmake build trees Alex --- Source/cmInstallTargetGenerator.cxx | 32 +++++++++++++++++++++++--------- 1 file changed, 23 insertions(+), 9 deletions(-) diff --git a/Source/cmInstallTargetGenerator.cxx b/Source/cmInstallTargetGenerator.cxx index bd3f864..f3d04ef 100644 --- a/Source/cmInstallTargetGenerator.cxx +++ b/Source/cmInstallTargetGenerator.cxx @@ -172,19 +172,18 @@ void cmInstallTargetGenerator::GenerateScript(std::ostream& os) // Fix the install_name settings in installed binaries. if((type == cmTarget::SHARED_LIBRARY || type == cmTarget::MODULE_LIBRARY || - type == cmTarget::EXECUTABLE) && - this->Target->GetMakefile()->IsSet("CMAKE_INSTALL_NAME_TOOL")) + type == cmTarget::EXECUTABLE)) { this->AddInstallNamePatchRule(os, destination.c_str()); } - std::string destinationFilename = destination; - destinationFilename += "/"; - destinationFilename += cmSystemTools::GetFilenameName(fromFile); + std::string destinationFilename = destination; + destinationFilename += "/"; + destinationFilename += cmSystemTools::GetFilenameName(fromFile); - this->AddRanlibRule(os, type, destinationFilename); + this->AddRanlibRule(os, type, destinationFilename); - this->AddStripRule(os, destinationFilename); + this->AddStripRule(os, destinationFilename); } //---------------------------------------------------------------------------- @@ -347,6 +346,22 @@ void cmInstallTargetGenerator ::AddInstallNamePatchRule(std::ostream& os, const char* destination) { + std::string installNameTool = this->Target->GetMakefile()->GetDefinition( + "CMAKE_INSTALL_NAME_TOOL"); + + // hack: if a new cmake runs on an old build tree, CMAKE_INSTALL_NAME_TOOL + // isn't in the cache, because it was simply hardcoded. To make this work + // adjust it here. + if((this->Target->GetMakefile()->IsOn("APPLE")) && (!installNameTool.size())) + { + installNameTool = "install_name_tool"; + } + + if(!installNameTool.size()) + { + return; + } + // Build a map of build-tree install_name to install-tree install_name for // shared libraries linked to this target. std::map install_name_remap; @@ -425,8 +440,7 @@ void cmInstallTargetGenerator component_test += this->Component; component_test += ")$\""; os << "IF(" << component_test << ")\n"; - os << " EXECUTE_PROCESS(COMMAND \""; - os <Target->GetMakefile()->GetDefinition("CMAKE_INSTALL_NAME_TOOL"); + os << " EXECUTE_PROCESS(COMMAND \"" << installNameTool; os << "\""; if(!new_id.empty()) { -- cgit v0.12