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);
|
ebfg.SetCommand(this);
|
||||||
|
|
||||||
// Compute the set of configurations exported.
|
// Compute the set of configurations exported.
|
||||||
if(const char* types =
|
|
||||||
this->Makefile->GetDefinition("CMAKE_CONFIGURATION_TYPES"))
|
|
||||||
{
|
|
||||||
std::vector<std::string> configurationTypes;
|
std::vector<std::string> configurationTypes;
|
||||||
cmSystemTools::ExpandListArgument(types, configurationTypes);
|
this->Makefile->GetConfigurations(configurationTypes);
|
||||||
|
if(!configurationTypes.empty())
|
||||||
|
{
|
||||||
for(std::vector<std::string>::const_iterator
|
for(std::vector<std::string>::const_iterator
|
||||||
ci = configurationTypes.begin();
|
ci = configurationTypes.begin();
|
||||||
ci != configurationTypes.end(); ++ci)
|
ci != configurationTypes.end(); ++ci)
|
||||||
|
@ -164,11 +163,6 @@ bool cmExportCommand
|
||||||
ebfg.AddConfiguration(ci->c_str());
|
ebfg.AddConfiguration(ci->c_str());
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
else if(const char* config =
|
|
||||||
this->Makefile->GetDefinition("CMAKE_BUILD_TYPE"))
|
|
||||||
{
|
|
||||||
ebfg.AddConfiguration(config);
|
|
||||||
}
|
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
ebfg.AddConfiguration("");
|
ebfg.AddConfiguration("");
|
||||||
|
|
|
@ -722,27 +722,11 @@ void cmGlobalXCodeGenerator::SetCurrentLocalGenerator(cmLocalGenerator* gen)
|
||||||
|
|
||||||
// Select the current set of configuration types.
|
// Select the current set of configuration types.
|
||||||
this->CurrentConfigurationTypes.clear();
|
this->CurrentConfigurationTypes.clear();
|
||||||
if(this->XcodeVersion > 20)
|
this->CurrentMakefile->GetConfigurations(this->CurrentConfigurationTypes);
|
||||||
{
|
|
||||||
if(const char* types =
|
|
||||||
this->CurrentMakefile->GetDefinition("CMAKE_CONFIGURATION_TYPES"))
|
|
||||||
{
|
|
||||||
cmSystemTools::ExpandListArgument(types,
|
|
||||||
this->CurrentConfigurationTypes);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
if(this->CurrentConfigurationTypes.empty())
|
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.
|
// Compute the set of configurations.
|
||||||
std::vector<std::string> configurationTypes;
|
std::vector<std::string> configurationTypes;
|
||||||
if(const char* types =
|
const char* config =
|
||||||
this->Makefile->GetDefinition("CMAKE_CONFIGURATION_TYPES"))
|
this->Makefile->GetConfigurations(configurationTypes, false);
|
||||||
{
|
|
||||||
cmSystemTools::ExpandListArgument(types, configurationTypes);
|
|
||||||
}
|
|
||||||
const char* config = 0;
|
|
||||||
if(configurationTypes.empty())
|
|
||||||
{
|
|
||||||
config = this->Makefile->GetDefinition("CMAKE_BUILD_TYPE");
|
|
||||||
}
|
|
||||||
|
|
||||||
std::string file = this->Makefile->GetStartOutputDirectory();
|
std::string file = this->Makefile->GetStartOutputDirectory();
|
||||||
file += "/";
|
file += "/";
|
||||||
|
@ -383,16 +375,8 @@ void cmLocalGenerator::GenerateInstallRules()
|
||||||
|
|
||||||
// Compute the set of configurations.
|
// Compute the set of configurations.
|
||||||
std::vector<std::string> configurationTypes;
|
std::vector<std::string> configurationTypes;
|
||||||
if(const char* types =
|
const char* config =
|
||||||
this->Makefile->GetDefinition("CMAKE_CONFIGURATION_TYPES"))
|
this->Makefile->GetConfigurations(configurationTypes, false);
|
||||||
{
|
|
||||||
cmSystemTools::ExpandListArgument(types, configurationTypes);
|
|
||||||
}
|
|
||||||
const char* config = 0;
|
|
||||||
if(configurationTypes.empty())
|
|
||||||
{
|
|
||||||
config = this->Makefile->GetDefinition("CMAKE_BUILD_TYPE");
|
|
||||||
}
|
|
||||||
|
|
||||||
// Choose a default install configuration.
|
// Choose a default install configuration.
|
||||||
const char* default_config = config;
|
const char* default_config = config;
|
||||||
|
@ -546,19 +530,7 @@ void cmLocalGenerator::GenerateTargetManifest()
|
||||||
{
|
{
|
||||||
// Collect the set of configuration types.
|
// Collect the set of configuration types.
|
||||||
std::vector<std::string> configNames;
|
std::vector<std::string> configNames;
|
||||||
if(const char* configurationTypes =
|
this->Makefile->GetConfigurations(configNames);
|
||||||
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);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
// Add our targets to the manifest for each configuration.
|
// Add our targets to the manifest for each configuration.
|
||||||
cmTargets& targets = this->Makefile->GetTargets();
|
cmTargets& targets = this->Makefile->GetTargets();
|
||||||
|
|
|
@ -1436,16 +1436,7 @@ void cmMakefile::InitializeFromParent()
|
||||||
this->SetProperty("COMPILE_DEFINITIONS",
|
this->SetProperty("COMPILE_DEFINITIONS",
|
||||||
parent->GetProperty("COMPILE_DEFINITIONS"));
|
parent->GetProperty("COMPILE_DEFINITIONS"));
|
||||||
std::vector<std::string> configs;
|
std::vector<std::string> configs;
|
||||||
if(const char* configTypes =
|
this->GetConfigurations(configs);
|
||||||
this->GetDefinition("CMAKE_CONFIGURATION_TYPES"))
|
|
||||||
{
|
|
||||||
cmSystemTools::ExpandListArgument(configTypes, configs);
|
|
||||||
}
|
|
||||||
else if(const char* buildType =
|
|
||||||
this->GetDefinition("CMAKE_BUILD_TYPE"))
|
|
||||||
{
|
|
||||||
configs.push_back(buildType);
|
|
||||||
}
|
|
||||||
for(std::vector<std::string>::const_iterator ci = configs.begin();
|
for(std::vector<std::string>::const_iterator ci = configs.begin();
|
||||||
ci != configs.end(); ++ci)
|
ci != configs.end(); ++ci)
|
||||||
{
|
{
|
||||||
|
@ -2367,6 +2358,31 @@ void cmMakefile::AddDefaultDefinitions()
|
||||||
cmake::GetCMakeFilesDirectory());
|
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)
|
#if defined(CMAKE_BUILD_WITH_CMAKE)
|
||||||
/**
|
/**
|
||||||
* Find a source group whose regular expression matches the filename
|
* Find a source group whose regular expression matches the filename
|
||||||
|
|
|
@ -310,6 +310,10 @@ public:
|
||||||
return this->ProjectName.c_str();
|
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.
|
* Set the name of the library.
|
||||||
*/
|
*/
|
||||||
|
|
|
@ -1040,18 +1040,7 @@ void cmTarget::SetMakefile(cmMakefile* mf)
|
||||||
|
|
||||||
// Collect the set of configuration types.
|
// Collect the set of configuration types.
|
||||||
std::vector<std::string> configNames;
|
std::vector<std::string> configNames;
|
||||||
if(const char* configurationTypes =
|
mf->GetConfigurations(configNames);
|
||||||
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);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
// Setup per-configuration property default values.
|
// Setup per-configuration property default values.
|
||||||
const char* configProps[] = {
|
const char* configProps[] = {
|
||||||
|
|
Loading…
Reference in New Issue