[cmake-commits] andy committed cmCPackGenericGenerator.cxx 1.36 1.37
cmCPackGenericGenerator.h 1.13 1.14 cpack.cxx 1.26 1.27
cmake-commits at cmake.org
cmake-commits at cmake.org
Thu Oct 12 13:05:52 EDT 2006
Update of /cvsroot/CMake/CMake/Source/CPack
In directory public:/mounts/ram/cvs-serv6061/Source/CPack
Modified Files:
cmCPackGenericGenerator.cxx cmCPackGenericGenerator.h
cpack.cxx
Log Message:
ENH: Several CPack fixes. First, allow user to set CMAKE_MODULE_PATH for CPack; make SetOptionIfNotSet more robust to handle empty options; do test TGZ, STGZ, and TZ, Add handling (and test) of Install Script; set environment variable CMAKE_INSTALL_PREFIX
Index: cmCPackGenericGenerator.cxx
===================================================================
RCS file: /cvsroot/CMake/CMake/Source/CPack/cmCPackGenericGenerator.cxx,v
retrieving revision 1.36
retrieving revision 1.37
diff -u -d -r1.36 -r1.37
--- cmCPackGenericGenerator.cxx 10 Jul 2006 11:59:05 -0000 1.36
+++ cmCPackGenericGenerator.cxx 12 Oct 2006 17:05:50 -0000 1.37
@@ -184,6 +184,14 @@
return 0;
}
+ // If the CPackConfig file sets CPACK_INSTALL_SCRIPT then run them
+ // as listed
+ if ( !this->InstallProjectViaInstallScript(
+ movable, tempInstallDirectory) )
+ {
+ return 0;
+ }
+
// If the CPackConfig file sets CPACK_INSTALLED_DIRECTORIES
// then glob it and copy it to CPACK_TEMPORARY_DIRECTORY
// This is used in Source packageing
@@ -258,6 +266,9 @@
const char* installCommands = this->GetOption("CPACK_INSTALL_COMMANDS");
if ( installCommands && *installCommands )
{
+ std::string tempInstallDirectoryEnv = "CMAKE_INSTALL_PREFIX=";
+ tempInstallDirectoryEnv += tempInstallDirectory;
+ cmSystemTools::PutEnv(tempInstallDirectoryEnv.c_str());
std::vector<std::string> installCommandsVector;
cmSystemTools::ExpandListArgument(installCommands,installCommandsVector);
std::vector<std::string>::iterator it;
@@ -391,6 +402,46 @@
}
//----------------------------------------------------------------------
+int cmCPackGenericGenerator::InstallProjectViaInstallScript(
+ bool movable, const char* tempInstallDirectory)
+{
+ const char* cmakeScripts
+ = this->GetOption("CPACK_INSTALL_SCRIPT");
+ std::string currentWorkingDirectory =
+ cmSystemTools::GetCurrentWorkingDirectory();
+ cmCPackLogger(cmCPackLog::LOG_OUTPUT,
+ "- Install scripts: " << cmakeScripts << std::endl);
+ if ( cmakeScripts && *cmakeScripts )
+ {
+ std::vector<std::string> cmakeScriptsVector;
+ cmSystemTools::ExpandListArgument(cmakeScripts,
+ cmakeScriptsVector);
+ std::vector<std::string>::iterator it;
+ for ( it = cmakeScriptsVector.begin();
+ it != cmakeScriptsVector.end();
+ ++it )
+ {
+ std::string installScript = it->c_str();
+
+ cmCPackLogger(cmCPackLog::LOG_OUTPUT,
+ "- Install script: " << installScript << std::endl);
+ if ( movable )
+ {
+ this->SetOption("CMAKE_INSTALL_PREFIX", tempInstallDirectory);
+ }
+ this->SetOptionIfNotSet("CMAKE_CURRENT_BINARY_DIR", tempInstallDirectory);
+ this->SetOptionIfNotSet("CMAKE_CURRENT_SOURCE_DIR", tempInstallDirectory);
+ int res = this->MakefileMap->ReadListFile(0, installScript.c_str());
+ if ( cmSystemTools::GetErrorOccuredFlag() || !res )
+ {
+ return 0;
+ }
+ }
+ }
+ return 1;
+}
+
+//----------------------------------------------------------------------
int cmCPackGenericGenerator::InstallProjectViaInstallCMakeProjects(
bool movable, const char* tempInstallDirectory)
{
@@ -535,7 +586,8 @@
void cmCPackGenericGenerator::SetOptionIfNotSet(const char* op,
const char* value)
{
- if ( this->MakefileMap->GetDefinition(op) )
+ const char* def = this->MakefileMap->GetDefinition(op);
+ if ( def && *def )
{
return;
}
Index: cpack.cxx
===================================================================
RCS file: /cvsroot/CMake/CMake/Source/CPack/cpack.cxx,v
retrieving revision 1.26
retrieving revision 1.27
diff -u -d -r1.26 -r1.27
--- cpack.cxx 31 Jul 2006 14:28:30 -0000 1.26
+++ cpack.cxx 12 Oct 2006 17:05:50 -0000 1.27
@@ -301,6 +301,11 @@
globalMF->AddDefinition(cdit->first.c_str(), cdit->second.c_str());
}
+ const char* cpackModulesPath = globalMF->GetDefinition("CPACK_MODULE_PATH");
+ if ( cpackModulesPath )
+ {
+ globalMF->AddDefinition("CMAKE_MODULE_PATH", cpackModulesPath);
+ }
const char* genList = globalMF->GetDefinition("CPACK_GENERATOR");
if ( !genList )
{
Index: cmCPackGenericGenerator.h
===================================================================
RCS file: /cvsroot/CMake/CMake/Source/CPack/cmCPackGenericGenerator.h,v
retrieving revision 1.13
retrieving revision 1.14
diff -u -d -r1.13 -r1.14
--- cmCPackGenericGenerator.h 9 Jul 2006 17:20:07 -0000 1.13
+++ cmCPackGenericGenerator.h 12 Oct 2006 17:05:50 -0000 1.14
@@ -110,6 +110,8 @@
//! Run install commands if specified
virtual int InstallProjectViaInstallCommands(
bool movable, const char* tempInstallDirectory);
+ virtual int InstallProjectViaInstallScript(
+ bool movable, const char* tempInstallDirectory);
virtual int InstallProjectViaInstalledDirectories(
bool movable, const char* tempInstallDirectory);
virtual int InstallProjectViaInstallCMakeProjects(
More information about the Cmake-commits
mailing list