summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorBrad King <brad.king@kitware.com>2010-09-08 18:54:49 (GMT)
committerBrad King <brad.king@kitware.com>2010-09-08 18:54:49 (GMT)
commitb06fb1668424514bf45794d40bfc9f88dd5d619c (patch)
tree66ae0b807e08cf844b9786624ce441f5563f7a8c
parentf444b9555f87ec187bff51d48cd29c22ab4a6121 (diff)
downloadCMake-b06fb1668424514bf45794d40bfc9f88dd5d619c.zip
CMake-b06fb1668424514bf45794d40bfc9f88dd5d619c.tar.gz
CMake-b06fb1668424514bf45794d40bfc9f88dd5d619c.tar.bz2
No CMAKE_CONFIGURATION_TYPES in single-config generators (#10202)
Factor out reading of CMAKE_CONFIGURATION_TYPES and CMAKE_BUILD_TYPE into cmMakefile::GetConfigurations. Read the former only in multi-config generators.
-rw-r--r--Source/cmExportCommand.cxx12
-rw-r--r--Source/cmGlobalXCodeGenerator.cxx20
-rw-r--r--Source/cmLocalGenerator.cxx38
-rw-r--r--Source/cmMakefile.cxx36
-rw-r--r--Source/cmMakefile.h6
-rw-r--r--Source/cmTarget.cxx13
6 files changed, 42 insertions, 83 deletions
diff --git a/Source/cmExportCommand.cxx b/Source/cmExportCommand.cxx
index 48c5c6e..cb614d4 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<std::string> configurationTypes;
+ this->Makefile->GetConfigurations(configurationTypes);
+ if(!configurationTypes.empty())
{
- std::vector<std::string> configurationTypes;
- cmSystemTools::ExpandListArgument(types, configurationTypes);
for(std::vector<std::string>::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 537a88f..c63b403 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 bac0223..5bffd52 100644
--- a/Source/cmLocalGenerator.cxx
+++ b/Source/cmLocalGenerator.cxx
@@ -278,16 +278,8 @@ void cmLocalGenerator::GenerateTestFiles()
// Compute the set of configurations.
std::vector<std::string> 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<std::string> 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<std::string> 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 8eece6b..c64053a 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<std::string> 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<std::string>::const_iterator ci = configs.begin();
ci != configs.end(); ++ci)
{
@@ -2367,6 +2358,31 @@ void cmMakefile::AddDefaultDefinitions()
cmake::GetCMakeFilesDirectory());
}
+//----------------------------------------------------------------------------
+const char*
+cmMakefile::GetConfigurations(std::vector<std::string>& 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 4fae7ee..8b8a3f8 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<std::string>& configs,
+ bool single = true) const;
+
/**
* Set the name of the library.
*/
diff --git a/Source/cmTarget.cxx b/Source/cmTarget.cxx
index 9611912..591b0d1 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<std::string> 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[] = {