diff --git a/Source/cmExportCommand.cxx b/Source/cmExportCommand.cxx index 48c5c6e6a..cb614d4f3 100644 --- a/Source/cmExportCommand.cxx +++ b/Source/cmExportCommand.cxx @@ -152,11 +152,10 @@ bool cmExportCommand ebfg.SetCommand(this); // Compute the set of configurations exported. - if(const char* types = - this->Makefile->GetDefinition("CMAKE_CONFIGURATION_TYPES")) + std::vector configurationTypes; + this->Makefile->GetConfigurations(configurationTypes); + if(!configurationTypes.empty()) { - std::vector configurationTypes; - cmSystemTools::ExpandListArgument(types, configurationTypes); for(std::vector::const_iterator ci = configurationTypes.begin(); ci != configurationTypes.end(); ++ci) @@ -164,11 +163,6 @@ bool cmExportCommand ebfg.AddConfiguration(ci->c_str()); } } - else if(const char* config = - this->Makefile->GetDefinition("CMAKE_BUILD_TYPE")) - { - ebfg.AddConfiguration(config); - } else { ebfg.AddConfiguration(""); diff --git a/Source/cmGlobalXCodeGenerator.cxx b/Source/cmGlobalXCodeGenerator.cxx index 537a88f30..c63b4034d 100644 --- a/Source/cmGlobalXCodeGenerator.cxx +++ b/Source/cmGlobalXCodeGenerator.cxx @@ -722,26 +722,10 @@ void cmGlobalXCodeGenerator::SetCurrentLocalGenerator(cmLocalGenerator* gen) // Select the current set of configuration types. this->CurrentConfigurationTypes.clear(); - if(this->XcodeVersion > 20) - { - if(const char* types = - this->CurrentMakefile->GetDefinition("CMAKE_CONFIGURATION_TYPES")) - { - cmSystemTools::ExpandListArgument(types, - this->CurrentConfigurationTypes); - } - } + this->CurrentMakefile->GetConfigurations(this->CurrentConfigurationTypes); if(this->CurrentConfigurationTypes.empty()) { - if(const char* buildType = - this->CurrentMakefile->GetDefinition("CMAKE_BUILD_TYPE")) - { - this->CurrentConfigurationTypes.push_back(buildType); - } - else - { - this->CurrentConfigurationTypes.push_back(""); - } + this->CurrentConfigurationTypes.push_back(""); } } diff --git a/Source/cmLocalGenerator.cxx b/Source/cmLocalGenerator.cxx index bac0223b5..5bffd5236 100644 --- a/Source/cmLocalGenerator.cxx +++ b/Source/cmLocalGenerator.cxx @@ -278,16 +278,8 @@ void cmLocalGenerator::GenerateTestFiles() // Compute the set of configurations. std::vector configurationTypes; - if(const char* types = - this->Makefile->GetDefinition("CMAKE_CONFIGURATION_TYPES")) - { - cmSystemTools::ExpandListArgument(types, configurationTypes); - } - const char* config = 0; - if(configurationTypes.empty()) - { - config = this->Makefile->GetDefinition("CMAKE_BUILD_TYPE"); - } + const char* config = + this->Makefile->GetConfigurations(configurationTypes, false); std::string file = this->Makefile->GetStartOutputDirectory(); file += "/"; @@ -383,16 +375,8 @@ void cmLocalGenerator::GenerateInstallRules() // Compute the set of configurations. std::vector configurationTypes; - if(const char* types = - this->Makefile->GetDefinition("CMAKE_CONFIGURATION_TYPES")) - { - cmSystemTools::ExpandListArgument(types, configurationTypes); - } - const char* config = 0; - if(configurationTypes.empty()) - { - config = this->Makefile->GetDefinition("CMAKE_BUILD_TYPE"); - } + const char* config = + this->Makefile->GetConfigurations(configurationTypes, false); // Choose a default install configuration. const char* default_config = config; @@ -546,19 +530,7 @@ void cmLocalGenerator::GenerateTargetManifest() { // Collect the set of configuration types. std::vector configNames; - if(const char* configurationTypes = - this->Makefile->GetDefinition("CMAKE_CONFIGURATION_TYPES")) - { - cmSystemTools::ExpandListArgument(configurationTypes, configNames); - } - else if(const char* buildType = - this->Makefile->GetDefinition("CMAKE_BUILD_TYPE")) - { - if(*buildType) - { - configNames.push_back(buildType); - } - } + this->Makefile->GetConfigurations(configNames); // Add our targets to the manifest for each configuration. cmTargets& targets = this->Makefile->GetTargets(); diff --git a/Source/cmMakefile.cxx b/Source/cmMakefile.cxx index 8eece6b5a..c64053aa7 100644 --- a/Source/cmMakefile.cxx +++ b/Source/cmMakefile.cxx @@ -1436,16 +1436,7 @@ void cmMakefile::InitializeFromParent() this->SetProperty("COMPILE_DEFINITIONS", parent->GetProperty("COMPILE_DEFINITIONS")); std::vector configs; - if(const char* configTypes = - this->GetDefinition("CMAKE_CONFIGURATION_TYPES")) - { - cmSystemTools::ExpandListArgument(configTypes, configs); - } - else if(const char* buildType = - this->GetDefinition("CMAKE_BUILD_TYPE")) - { - configs.push_back(buildType); - } + this->GetConfigurations(configs); for(std::vector::const_iterator ci = configs.begin(); ci != configs.end(); ++ci) { @@ -2367,6 +2358,31 @@ void cmMakefile::AddDefaultDefinitions() cmake::GetCMakeFilesDirectory()); } +//---------------------------------------------------------------------------- +const char* +cmMakefile::GetConfigurations(std::vector& configs, + bool single) const +{ + if(this->LocalGenerator->GetGlobalGenerator()->IsMultiConfig()) + { + if(const char* configTypes = + this->GetDefinition("CMAKE_CONFIGURATION_TYPES")) + { + cmSystemTools::ExpandListArgument(configTypes, configs); + } + return 0; + } + else + { + const char* buildType = this->GetDefinition("CMAKE_BUILD_TYPE"); + if(single && buildType && *buildType) + { + configs.push_back(buildType); + } + return buildType; + } +} + #if defined(CMAKE_BUILD_WITH_CMAKE) /** * Find a source group whose regular expression matches the filename diff --git a/Source/cmMakefile.h b/Source/cmMakefile.h index 4fae7eee2..8b8a3f858 100644 --- a/Source/cmMakefile.h +++ b/Source/cmMakefile.h @@ -309,7 +309,11 @@ public: { return this->ProjectName.c_str(); } - + + /** Get the configurations to be generated. */ + const char* GetConfigurations(std::vector& configs, + bool single = true) const; + /** * Set the name of the library. */ diff --git a/Source/cmTarget.cxx b/Source/cmTarget.cxx index 961191269..591b0d196 100644 --- a/Source/cmTarget.cxx +++ b/Source/cmTarget.cxx @@ -1040,18 +1040,7 @@ void cmTarget::SetMakefile(cmMakefile* mf) // Collect the set of configuration types. std::vector configNames; - if(const char* configurationTypes = - mf->GetDefinition("CMAKE_CONFIGURATION_TYPES")) - { - cmSystemTools::ExpandListArgument(configurationTypes, configNames); - } - else if(const char* buildType = mf->GetDefinition("CMAKE_BUILD_TYPE")) - { - if(*buildType) - { - configNames.push_back(buildType); - } - } + mf->GetConfigurations(configNames); // Setup per-configuration property default values. const char* configProps[] = {