diff options
author | Brad King <brad.king@kitware.com> | 2006-05-05 18:57:19 (GMT) |
---|---|---|
committer | Brad King <brad.king@kitware.com> | 2006-05-05 18:57:19 (GMT) |
commit | 50a0f71120afe28c205bacab5a1350eb04815f3d (patch) | |
tree | 7f3473d0e452b39c63e59763cca41167f3483a26 /Source/cmLocalGenerator.cxx | |
parent | 059320a5774fcaaced1a6155fec7dd5816bb1f75 (diff) | |
download | CMake-50a0f71120afe28c205bacab5a1350eb04815f3d.zip CMake-50a0f71120afe28c205bacab5a1350eb04815f3d.tar.gz CMake-50a0f71120afe28c205bacab5a1350eb04815f3d.tar.bz2 |
ENH: Added CONFIGURATIONS option to INSTALL command to allow per-configuration install rules.
Diffstat (limited to 'Source/cmLocalGenerator.cxx')
-rw-r--r-- | Source/cmLocalGenerator.cxx | 34 |
1 files changed, 31 insertions, 3 deletions
diff --git a/Source/cmLocalGenerator.cxx b/Source/cmLocalGenerator.cxx index 1641fc8..4241e4c 100644 --- a/Source/cmLocalGenerator.cxx +++ b/Source/cmLocalGenerator.cxx @@ -289,6 +289,30 @@ void cmLocalGenerator::GenerateInstallRules() config = this->Makefile->GetDefinition("CMAKE_BUILD_TYPE"); } + // Choose a default install configuration. + const char* default_config = config; + const char* default_order[] = {"RELEASE", "MINSIZEREL", + "RELWITHDEBINFO", "DEBUG", 0}; + for(const char** c = default_order; *c && !default_config; ++c) + { + for(std::vector<std::string>::iterator i = configurationTypes.begin(); + i != configurationTypes.end(); ++i) + { + if(cmSystemTools::UpperCase(*i) == *c) + { + default_config = i->c_str(); + } + } + } + if(!default_config && !configurationTypes.empty()) + { + default_config = configurationTypes[0].c_str(); + } + if(!default_config) + { + default_config = "Release"; + } + // Create the install script file. std::string file = this->Makefile->GetStartOutputDirectory(); std::string homedir = this->Makefile->GetHomeOutputDirectory(); @@ -323,7 +347,7 @@ void cmLocalGenerator::GenerateInstallRules() " STRING(REGEX REPLACE \"^[^A-Za-z0-9_]+\" \"\"\n" " CMAKE_INSTALL_CONFIG_NAME \"${BUILD_TYPE}\")\n" " ELSE(BUILD_TYPE)\n" - " SET(CMAKE_INSTALL_CONFIG_NAME Release)\n" + " SET(CMAKE_INSTALL_CONFIG_NAME \"" << default_config << "\")\n" " ENDIF(BUILD_TYPE)\n" " MESSAGE(STATUS \"Install configuration: \\\"${CMAKE_INSTALL_CONFIG_NAME}\\\"\")\n" "ENDIF(NOT CMAKE_INSTALL_CONFIG_NAME)\n" @@ -1955,9 +1979,11 @@ cmLocalGenerator const char* no_permissions = ""; const char* no_rename = ""; const char* no_component = ""; + std::vector<std::string> no_configurations; cmInstallFilesGenerator g(l->second.GetSourceLists(), destination.c_str(), false, - no_permissions, no_component, no_rename); + no_permissions, no_configurations, + no_component, no_rename); g.Generate(os, config, configurationTypes); } break; @@ -1967,9 +1993,11 @@ cmLocalGenerator const char* no_permissions = ""; const char* no_rename = ""; const char* no_component = ""; + std::vector<std::string> no_configurations; cmInstallFilesGenerator g(l->second.GetSourceLists(), destination.c_str(), true, - no_permissions, no_component, no_rename); + no_permissions, no_configurations, + no_component, no_rename); g.Generate(os, config, configurationTypes); } break; |