summaryrefslogtreecommitdiffstats
path: root/Source
diff options
context:
space:
mode:
authorEric NOULARD <eric.noulard@gmail.com>2010-08-23 15:38:33 (GMT)
committerEric NOULARD <eric.noulard@gmail.com>2010-08-23 15:38:33 (GMT)
commit6a521f8604ee4e6a757109e731a36fdc5575f6c8 (patch)
tree2a0ef90109f4c057d3673922448ee24549f9eb0a /Source
parent40dc97dc73b67d76442b386b73c57437fa72db34 (diff)
downloadCMake-6a521f8604ee4e6a757109e731a36fdc5575f6c8.zip
CMake-6a521f8604ee4e6a757109e731a36fdc5575f6c8.tar.gz
CMake-6a521f8604ee4e6a757109e731a36fdc5575f6c8.tar.bz2
CPack Enable better handling of absolute installed files
The idea of the patch is to let the install generator define CPACK_ABSOLUTE_INSTALL_FILES then when CMake is installing project he will concatenate the list of files and give it to specific CPack Generator by defining CPACK_ABSOLUTE_INSTALL_FILES to be the list of ALL files that were installed using absolute destination. An example of use has been applied to RPM generator which now tries to automatically build a relocatable package.
Diffstat (limited to 'Source')
-rw-r--r--Source/CPack/cmCPackGenerator.cxx11
-rw-r--r--Source/cmInstallGenerator.cxx20
2 files changed, 31 insertions, 0 deletions
diff --git a/Source/CPack/cmCPackGenerator.cxx b/Source/CPack/cmCPackGenerator.cxx
index e44fa7b..8ffcedc 100644
--- a/Source/CPack/cmCPackGenerator.cxx
+++ b/Source/CPack/cmCPackGenerator.cxx
@@ -461,6 +461,7 @@ int cmCPackGenerator::InstallProjectViaInstallCMakeProjects(
= this->GetOption("CPACK_INSTALL_CMAKE_PROJECTS");
const char* cmakeGenerator
= this->GetOption("CPACK_CMAKE_GENERATOR");
+ std::string absoluteDestFiles;
if ( cmakeProjects && *cmakeProjects )
{
if ( !cmakeGenerator )
@@ -735,6 +736,15 @@ int cmCPackGenerator::InstallProjectViaInstallCMakeProjects(
mf->AddDefinition("CMAKE_INSTALL_DO_STRIP", "1");
}
int res = mf->ReadListFile(0, installFile.c_str());
+ if (NULL !=mf->GetDefinition("CPACK_ABSOLUTE_DESTINATION_FILES")) {
+ if (absoluteDestFiles.length()>0) {
+ absoluteDestFiles +=";";
+ }
+ absoluteDestFiles += mf->GetDefinition("CPACK_ABSOLUTE_DESTINATION_FILES");
+ cmCPackLogger(cmCPackLog::LOG_DEBUG,
+ "Got some ABSOLUTE DESTINATION FILES: "
+ << absoluteDestFiles << std::endl);
+ }
if ( cmSystemTools::GetErrorOccuredFlag() || !res )
{
return 0;
@@ -742,6 +752,7 @@ int cmCPackGenerator::InstallProjectViaInstallCMakeProjects(
}
}
}
+ this->SetOption("CPACK_ABSOLUTE_DESTINATION_FILES",absoluteDestFiles.c_str());
return 1;
}
diff --git a/Source/cmInstallGenerator.cxx b/Source/cmInstallGenerator.cxx
index 47ca769..9d5e416 100644
--- a/Source/cmInstallGenerator.cxx
+++ b/Source/cmInstallGenerator.cxx
@@ -60,6 +60,26 @@ void cmInstallGenerator
}
os << indent;
std::string dest = this->GetInstallDestination();
+ if (cmSystemTools::FileIsFullPath(dest.c_str()))
+ {
+ os << "list(APPEND CPACK_ABSOLUTE_DESTINATION_FILES\n";
+ os << indent << " \"";
+ for(std::vector<std::string>::const_iterator fi = files.begin();
+ fi != files.end(); ++fi)
+ {
+ if (fi!=files.begin()) os << ";";
+ os << dest << cmSystemTools::ConvertToOutputPath("/");
+ if (rename && *rename)
+ {
+ os << rename;
+ }
+ else
+ {
+ os << cmSystemTools::GetFilenameName(*fi);
+ }
+ }
+ os << "\")\n";
+ }
os << "FILE(INSTALL DESTINATION \"" << dest << "\" TYPE " << stype.c_str();
if(optional)
{