From ea7c7bb34dc55fc830e58102181e47c2f1488d83 Mon Sep 17 00:00:00 2001 From: Andy Cedilnik Date: Sat, 10 Dec 2005 12:11:20 -0500 Subject: [PATCH] ENH: Allow the installer to overwrite the install prefix --- Source/cmLocalGenerator.cxx | 9 +++++++-- 1 file changed, 7 insertions(+), 2 deletions(-) diff --git a/Source/cmLocalGenerator.cxx b/Source/cmLocalGenerator.cxx index f48f760f3..60ca2ed06 100644 --- a/Source/cmLocalGenerator.cxx +++ b/Source/cmLocalGenerator.cxx @@ -287,6 +287,11 @@ void cmLocalGenerator::GenerateInstallRules() fout << "# Install script for directory: " << m_Makefile->GetCurrentDirectory() << std::endl << std::endl; + fout << "# Set the install prefix" << std::endl + << "IF(NOT CMAKE_INSTALL_PREFIX)" << std::endl + << " SET(CMAKE_INSTALL_PREFIX \"" << prefix << "\")" << std::endl + << "ENDIF(NOT CMAKE_INSTALL_PREFIX)" << std::endl + << std::endl; const char* cmakeDebugPosfix = m_Makefile->GetDefinition("CMAKE_DEBUG_POSTFIX"); if ( cmakeDebugPosfix ) @@ -344,7 +349,7 @@ void cmLocalGenerator::GenerateInstallRules() } if (l->second.GetInstallPath() != "") { - destination = prefix + l->second.GetInstallPath(); + destination = "${CMAKE_INSTALL_PREFIX}/" + l->second.GetInstallPath(); cmSystemTools::ConvertToUnixSlashes(destination); const char* dest = destination.c_str(); int type = l->second.GetType(); @@ -376,7 +381,7 @@ void cmLocalGenerator::GenerateInstallRules() libname += ".lib"; files = libname.c_str(); this->AddInstallRule(fout, dest, cmTarget::STATIC_LIBRARY, files, true); - std::string dlldest = prefix + l->second.GetRuntimeInstallPath(); + std::string dlldest = "${CMAKE_INSTALL_PREFIX}/" + l->second.GetRuntimeInstallPath(); files = fname.c_str(); this->AddInstallRule(fout, dlldest.c_str(), type, files); }