diff options
author | Ben Boeckel <ben.boeckel@kitware.com> | 2014-02-10 03:48:34 (GMT) |
---|---|---|
committer | Brad King <brad.king@kitware.com> | 2014-03-08 18:05:36 (GMT) |
commit | 84fdc9921cab35addba8c57cd201778de2cf87a4 (patch) | |
tree | a43cc1d2782da4bd54734beb3fa5494048a08a18 /Source/cmScriptGenerator.cxx | |
parent | f154475b65738444414312d7d5a255f3220d90c6 (diff) | |
download | CMake-84fdc9921cab35addba8c57cd201778de2cf87a4.zip CMake-84fdc9921cab35addba8c57cd201778de2cf87a4.tar.gz CMake-84fdc9921cab35addba8c57cd201778de2cf87a4.tar.bz2 |
stringapi: Pass configuration names as strings
Diffstat (limited to 'Source/cmScriptGenerator.cxx')
-rw-r--r-- | Source/cmScriptGenerator.cxx | 21 |
1 files changed, 11 insertions, 10 deletions
diff --git a/Source/cmScriptGenerator.cxx b/Source/cmScriptGenerator.cxx index 7a8efc1..7685d40 100644 --- a/Source/cmScriptGenerator.cxx +++ b/Source/cmScriptGenerator.cxx @@ -19,7 +19,7 @@ cmScriptGenerator std::vector<std::string> const& configurations): RuntimeConfigVariable(config_var), Configurations(configurations), - ConfigurationName(0), + ConfigurationName(""), ConfigurationTypes(0), ActionsPerConfig(false) { @@ -34,21 +34,21 @@ cmScriptGenerator //---------------------------------------------------------------------------- void cmScriptGenerator -::Generate(std::ostream& os, const char* config, +::Generate(std::ostream& os, const std::string& config, std::vector<std::string> const& configurationTypes) { this->ConfigurationName = config; this->ConfigurationTypes = &configurationTypes; this->GenerateScript(os); - this->ConfigurationName = 0; + this->ConfigurationName = ""; this->ConfigurationTypes = 0; } //---------------------------------------------------------------------------- -static void cmScriptGeneratorEncodeConfig(const char* config, +static void cmScriptGeneratorEncodeConfig(const std::string& config, std::string& result) { - for(const char* c = config; *c; ++c) + for(const char* c = config.c_str(); *c; ++c) { if(*c >= 'a' && *c <= 'z') { @@ -73,12 +73,12 @@ static void cmScriptGeneratorEncodeConfig(const char* config, //---------------------------------------------------------------------------- std::string -cmScriptGenerator::CreateConfigTest(const char* config) +cmScriptGenerator::CreateConfigTest(const std::string& config) { std::string result = "\"${"; result += this->RuntimeConfigVariable; result += "}\" MATCHES \"^("; - if(config && *config) + if(!config.empty()) { cmScriptGeneratorEncodeConfig(config, result); } @@ -142,14 +142,15 @@ void cmScriptGenerator::GenerateScriptActions(std::ostream& os, } //---------------------------------------------------------------------------- -void cmScriptGenerator::GenerateScriptForConfig(std::ostream&, const char*, +void cmScriptGenerator::GenerateScriptForConfig(std::ostream&, + const std::string&, Indent const&) { // No actions for this generator. } //---------------------------------------------------------------------------- -bool cmScriptGenerator::GeneratesForConfig(const char* config) +bool cmScriptGenerator::GeneratesForConfig(const std::string& config) { // If this is not a configuration-specific rule then we install. if(this->Configurations.empty()) @@ -159,7 +160,7 @@ bool cmScriptGenerator::GeneratesForConfig(const char* config) // This is a configuration-specific rule. Check if the config // matches this rule. - std::string config_upper = cmSystemTools::UpperCase(config?config:""); + std::string config_upper = cmSystemTools::UpperCase(config); for(std::vector<std::string>::const_iterator i = this->Configurations.begin(); i != this->Configurations.end(); ++i) |