From e48dc064022611e2fd86d5756c97e61bdb663822 Mon Sep 17 00:00:00 2001 From: Andy Cedilnik Date: Wed, 15 Mar 2006 09:22:51 -0500 Subject: [PATCH] ENH: Allow multiple install directories --- Source/CPack/cmCPackGenericGenerator.cxx | 53 ++++++++++++++---------- 1 file changed, 31 insertions(+), 22 deletions(-) diff --git a/Source/CPack/cmCPackGenericGenerator.cxx b/Source/CPack/cmCPackGenericGenerator.cxx index 4ceea028f..e32d0f84b 100644 --- a/Source/CPack/cmCPackGenericGenerator.cxx +++ b/Source/CPack/cmCPackGenericGenerator.cxx @@ -229,31 +229,40 @@ int cmCPackGenericGenerator::InstallProject() } } } - const char* binaryDir = this->GetOption("CPACK_BINARY_DIR"); - if ( binaryDir ) + const char* binaryDirectories = this->GetOption("CPACK_BINARY_DIR"); + if ( binaryDirectories ) { - std::string installFile = binaryDir; - installFile += "/cmake_install.cmake"; - cmake cm; - cmGlobalGenerator gg; - gg.SetCMakeInstance(&cm); - std::auto_ptr lg(gg.CreateLocalGenerator()); - lg->SetGlobalGenerator(&gg); - cmMakefile *mf = lg->GetMakefile(); - if ( movable ) + std::vector binaryDirectoriesVector; + cmSystemTools::ExpandListArgument(binaryDirectories, + binaryDirectoriesVector); + std::vector::iterator it; + for ( it = binaryDirectoriesVector.begin(); + it != binaryDirectoriesVector.end(); + ++it ) { - mf->AddDefinition("CMAKE_INSTALL_PREFIX", tempInstallDirectory); - } - const char* buildConfig = this->GetOption("CPACK_BUILD_CONFIG"); - if ( buildConfig && *buildConfig ) - { - mf->AddDefinition("BUILD_TYPE", buildConfig); - } + std::string installFile = it->c_str(); + installFile += "/cmake_install.cmake"; + cmake cm; + cmGlobalGenerator gg; + gg.SetCMakeInstance(&cm); + std::auto_ptr 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; + res = mf->ReadListFile(0, installFile.c_str()); + if ( cmSystemTools::GetErrorOccuredFlag() ) + { + res = 0; + } } } if ( !movable )