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.
This commit is contained in:
parent
f444b9555f
commit
b06fb16684
|
@ -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("");
|
||||
|
|
|
@ -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("");
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
@ -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();
|
||||
|
|
|
@ -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
|
||||
|
|
|
@ -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.
|
||||
*/
|
||||
|
|
|
@ -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[] = {
|
||||
|
|
Loading…
Reference in New Issue