cmake: Remove DebugConfigs member.

It adds needless complexity to global property handling.
This commit is contained in:
Stephen Kelly 2015-04-11 12:04:05 +02:00
parent 6fb306ea3b
commit ade20b433b
4 changed files with 19 additions and 35 deletions

View File

@ -1157,7 +1157,7 @@ cmTarget::LinkLibraryType cmTarget::ComputeLinkType(
} }
// Get the list of configurations considered to be DEBUG. // Get the list of configurations considered to be DEBUG.
std::vector<std::string> const& debugConfigs = std::vector<std::string> debugConfigs =
this->Makefile->GetCMakeInstance()->GetDebugConfigs(); this->Makefile->GetCMakeInstance()->GetDebugConfigs();
// Check if any entry in the list matches this configuration. // Check if any entry in the list matches this configuration.
@ -1216,7 +1216,7 @@ std::string cmTarget::GetDebugGeneratorExpressions(const std::string &value,
} }
// Get the list of configurations considered to be DEBUG. // Get the list of configurations considered to be DEBUG.
std::vector<std::string> const& debugConfigs = std::vector<std::string> debugConfigs =
this->Makefile->GetCMakeInstance()->GetDebugConfigs(); this->Makefile->GetCMakeInstance()->GetDebugConfigs();
std::string configString = "$<CONFIG:" + debugConfigs[0] + ">"; std::string configString = "$<CONFIG:" + debugConfigs[0] + ">";

View File

@ -467,7 +467,7 @@ cmTargetLinkLibrariesCommand::HandleLibrary(const std::string& lib,
} }
// Get the list of configurations considered to be DEBUG. // Get the list of configurations considered to be DEBUG.
std::vector<std::string> const& debugConfigs = std::vector<std::string> debugConfigs =
this->Makefile->GetCMakeInstance()->GetDebugConfigs(); this->Makefile->GetCMakeInstance()->GetDebugConfigs();
std::string prop; std::string prop;

View File

@ -2283,24 +2283,12 @@ bool cmake::IsPropertyChained(const std::string& name,
void cmake::SetProperty(const std::string& prop, const char* value) void cmake::SetProperty(const std::string& prop, const char* value)
{ {
// Special hook to invalidate cached value.
if(prop == "DEBUG_CONFIGURATIONS")
{
this->DebugConfigs.clear();
}
this->Properties.SetProperty(prop, value, cmProperty::GLOBAL); this->Properties.SetProperty(prop, value, cmProperty::GLOBAL);
} }
void cmake::AppendProperty(const std::string& prop, void cmake::AppendProperty(const std::string& prop,
const char* value, bool asString) const char* value, bool asString)
{ {
// Special hook to invalidate cached value.
if(prop == "DEBUG_CONFIGURATIONS")
{
this->DebugConfigs.clear();
}
this->Properties.AppendProperty(prop, value, cmProperty::GLOBAL, asString); this->Properties.AppendProperty(prop, value, cmProperty::GLOBAL, asString);
} }
@ -2758,27 +2746,24 @@ void cmake::IssueMessage(cmake::MessageType t, std::string const& text,
} }
//---------------------------------------------------------------------------- //----------------------------------------------------------------------------
std::vector<std::string> const& cmake::GetDebugConfigs() std::vector<std::string> cmake::GetDebugConfigs()
{ {
// Compute on-demand. std::vector<std::string> configs;
if(this->DebugConfigs.empty()) if(const char* config_list = this->GetProperty("DEBUG_CONFIGURATIONS"))
{ {
if(const char* config_list = this->GetProperty("DEBUG_CONFIGURATIONS")) // Expand the specified list and convert to upper-case.
{ cmSystemTools::ExpandListArgument(config_list, configs);
// Expand the specified list and convert to upper-case. std::transform(configs.begin(),
cmSystemTools::ExpandListArgument(config_list, this->DebugConfigs); configs.end(),
std::transform(this->DebugConfigs.begin(), configs.begin(),
this->DebugConfigs.end(), cmSystemTools::UpperCase);
this->DebugConfigs.begin(),
cmSystemTools::UpperCase);
}
// If no configurations were specified, use a default list.
if(this->DebugConfigs.empty())
{
this->DebugConfigs.push_back("DEBUG");
}
} }
return this->DebugConfigs; // If no configurations were specified, use a default list.
if(configs.empty())
{
configs.push_back("DEBUG");
}
return configs;
} }

View File

@ -359,7 +359,7 @@ class cmake
/** Get the list of configurations (in upper case) considered to be /** Get the list of configurations (in upper case) considered to be
debugging configurations.*/ debugging configurations.*/
std::vector<std::string> const& GetDebugConfigs(); std::vector<std::string> GetDebugConfigs();
void SetCMakeEditCommand(std::string const& s) void SetCMakeEditCommand(std::string const& s)
{ this->CMakeEditCommand = s; } { this->CMakeEditCommand = s; }
@ -469,7 +469,6 @@ private:
bool DebugTryCompile; bool DebugTryCompile;
cmFileTimeComparison* FileComparison; cmFileTimeComparison* FileComparison;
std::string GraphVizFile; std::string GraphVizFile;
std::vector<std::string> DebugConfigs;
InstalledFilesMap InstalledFiles; InstalledFilesMap InstalledFiles;
void UpdateConversionPathTable(); void UpdateConversionPathTable();