diff options
author | Andy Cedilnik <andy.cedilnik@kitware.com> | 2006-04-10 15:09:52 (GMT) |
---|---|---|
committer | Andy Cedilnik <andy.cedilnik@kitware.com> | 2006-04-10 15:09:52 (GMT) |
commit | 0bad15c302ddb52342beae4f2287a0bfc7c4edc2 (patch) | |
tree | a5d0fb3d728e9591f2aee2a5337cc0117c57a365 | |
parent | e2fb2b82be1d6e1f69b9e308bb6d065df494ab37 (diff) | |
download | CMake-0bad15c302ddb52342beae4f2287a0bfc7c4edc2.zip CMake-0bad15c302ddb52342beae4f2287a0bfc7c4edc2.tar.gz CMake-0bad15c302ddb52342beae4f2287a0bfc7c4edc2.tar.bz2 |
ENH: Deprecate CPACK_BINARY_DIR and add CPACK_INSTALL_CMAKE_PROJECTS
-rw-r--r-- | Modules/CPack.cmake | 2 | ||||
-rw-r--r-- | Source/CPack/cmCPackGenericGenerator.cxx | 45 |
2 files changed, 45 insertions, 2 deletions
diff --git a/Modules/CPack.cmake b/Modules/CPack.cmake index f99c5c4..c20da16 100644 --- a/Modules/CPack.cmake +++ b/Modules/CPack.cmake @@ -68,6 +68,8 @@ ENDIF(NOT CPACK_GENERATOR) # Set some other variables cpack_set_if_not_set(CPACK_BINARY_DIR "${CMAKE_BINARY_DIR}") +cpack_set_if_not_set(CPACK_INSTALL_CMAKE_PROJECTS + "${CMAKE_BINARY_DIR};${CMAKE_PROJECT_NAME}") SET(_CPACK_UNUSED_VARIABLES_) GET_CMAKE_PROPERTY(res VARIABLES) diff --git a/Source/CPack/cmCPackGenericGenerator.cxx b/Source/CPack/cmCPackGenericGenerator.cxx index f61b70d..14f9cda 100644 --- a/Source/CPack/cmCPackGenericGenerator.cxx +++ b/Source/CPack/cmCPackGenericGenerator.cxx @@ -119,7 +119,7 @@ int cmCPackGenericGenerator::PrepareNames() //---------------------------------------------------------------------- int cmCPackGenericGenerator::InstallProject() { - cmCPackLogger(cmCPackLog::LOG_OUTPUT, "Install project" << std::endl); + cmCPackLogger(cmCPackLog::LOG_OUTPUT, "Install projects" << std::endl); const char* tempInstallDirectory = this->GetOption("CPACK_TEMPORARY_INSTALL_DIRECTORY"); int res = 1; @@ -229,8 +229,49 @@ int cmCPackGenericGenerator::InstallProject() } } } + const char* cmakeProjects + = this->GetOption("CPACK_INSTALL_CMAKE_PROJECTS"); + if ( cmakeProjects ) + { + std::vector<std::string> cmakeProjectsVector; + cmSystemTools::ExpandListArgument(cmakeProjects, + cmakeProjectsVector); + std::vector<std::string>::iterator it; + for ( it = cmakeProjectsVector.begin(); + it != cmakeProjectsVector.end(); + ++it ) + { + std::string installDirectory = it->c_str(); + ++it; + std::string installProjectName = it->c_str(); + cmCPackLogger(cmCPackLog::LOG_OUTPUT, + "- Install project: " << installProjectName << std::endl); + std::string installFile = installDirectory + "/cmake_install.cmake"; + cmake cm; + cmGlobalGenerator gg; + gg.SetCMakeInstance(&cm); + std::auto_ptr<cmLocalGenerator> lg(gg.CreateLocalGenerator()); + lg->SetGlobalGenerator(&gg); + cmMakefile *mf = lg->GetMakefile(); + if ( movable ) + { + mf->AddDefinition("CMAKE_INSTALL_PREFIX", tempInstallDirectory); + } + const char* buildConfig = this->GetOption("CPACK_BUILD_CONFIG"); + if ( buildConfig && *buildConfig ) + { + mf->AddDefinition("BUILD_TYPE", buildConfig); + } + + res = mf->ReadListFile(0, installFile.c_str()); + if ( cmSystemTools::GetErrorOccuredFlag() ) + { + res = 0; + } + } + } const char* binaryDirectories = this->GetOption("CPACK_BINARY_DIR"); - if ( binaryDirectories ) + if ( binaryDirectories && !cmakeProjects ) { std::vector<std::string> binaryDirectoriesVector; cmSystemTools::ExpandListArgument(binaryDirectories, |