diff options
-rw-r--r-- | Source/cmGeneratorExpression.cxx | 6 | ||||
-rw-r--r-- | Source/cmGeneratorExpression.h | 15 | ||||
-rw-r--r-- | Source/cmGlobalXCodeGenerator.cxx | 8 | ||||
-rw-r--r-- | Source/cmMakefileTargetGenerator.cxx | 10 | ||||
-rw-r--r-- | Source/cmServerProtocol.cxx | 2 |
5 files changed, 18 insertions, 23 deletions
diff --git a/Source/cmGeneratorExpression.cxx b/Source/cmGeneratorExpression.cxx index b1b2b88..6823cd5 100644 --- a/Source/cmGeneratorExpression.cxx +++ b/Source/cmGeneratorExpression.cxx @@ -386,11 +386,11 @@ void cmCompiledGeneratorExpression::GetMaxLanguageStandard( } } -const char* cmGeneratorExpressionInterpreter::Evaluate( +const std::string& cmGeneratorExpressionInterpreter::Evaluate( const char* expression, const std::string& property) { if (this->Target.empty()) { - return this->EvaluateExpression(expression).c_str(); + return this->EvaluateExpression(expression); } // Specify COMPILE_OPTIONS to DAGchecker, same semantic as COMPILE_FLAGS @@ -398,5 +398,5 @@ const char* cmGeneratorExpressionInterpreter::Evaluate( this->Target, property == "COMPILE_FLAGS" ? "COMPILE_OPTIONS" : property, nullptr, nullptr); - return this->EvaluateExpression(expression, &dagChecker).c_str(); + return this->EvaluateExpression(expression, &dagChecker); } diff --git a/Source/cmGeneratorExpression.h b/Source/cmGeneratorExpression.h index 1ceb7da..2b7df91 100644 --- a/Source/cmGeneratorExpression.h +++ b/Source/cmGeneratorExpression.h @@ -179,17 +179,10 @@ public: { } - const char* Evaluate(const char* expression) - { - return this->EvaluateExpression(expression).c_str(); - } - const char* Evaluate(const std::string& expression) - { - return this->Evaluate(expression.c_str()); - } - const char* Evaluate(const char* expression, const std::string& property); - const char* Evaluate(const std::string& expression, - const std::string& property) + const std::string& Evaluate(const char* expression, + const std::string& property); + const std::string& Evaluate(const std::string& expression, + const std::string& property) { return this->Evaluate(expression.c_str(), property); } diff --git a/Source/cmGlobalXCodeGenerator.cxx b/Source/cmGlobalXCodeGenerator.cxx index 042ce41..37536fc 100644 --- a/Source/cmGlobalXCodeGenerator.cxx +++ b/Source/cmGlobalXCodeGenerator.cxx @@ -762,9 +762,10 @@ public: using cmGeneratorExpressionInterpreter::Evaluate; - const char* Evaluate(const char* expression, const std::string& property) + const std::string& Evaluate(const char* expression, + const std::string& property) { - const char* processed = + const std::string& processed = this->cmGeneratorExpressionInterpreter::Evaluate(expression, property); if (this->GetCompiledGeneratorExpression() .GetHadContextSensitiveCondition()) { @@ -821,7 +822,8 @@ cmXCodeObject* cmGlobalXCodeGenerator::CreateXCodeSourceFile( const std::string COMPILE_DEFINITIONS("COMPILE_DEFINITIONS"); if (const char* compile_defs = sf->GetProperty(COMPILE_DEFINITIONS)) { this->AppendDefines( - flagsBuild, genexInterpreter.Evaluate(compile_defs, COMPILE_DEFINITIONS), + flagsBuild, + genexInterpreter.Evaluate(compile_defs, COMPILE_DEFINITIONS).c_str(), true); } if (!flagsBuild.IsEmpty()) { diff --git a/Source/cmMakefileTargetGenerator.cxx b/Source/cmMakefileTargetGenerator.cxx index 79baca6..e8cf255 100644 --- a/Source/cmMakefileTargetGenerator.cxx +++ b/Source/cmMakefileTargetGenerator.cxx @@ -445,7 +445,7 @@ void cmMakefileTargetGenerator::WriteObjectBuildFile( // Add flags from source file properties. const std::string COMPILE_FLAGS("COMPILE_FLAGS"); if (const char* cflags = source.GetProperty(COMPILE_FLAGS)) { - const char* evaluatedFlags = + const std::string& evaluatedFlags = genexInterpreter.Evaluate(cflags, COMPILE_FLAGS); this->LocalGenerator->AppendFlags(flags, evaluatedFlags); *this->FlagFileStream << "# Custom flags: " << relativeObj @@ -455,7 +455,7 @@ void cmMakefileTargetGenerator::WriteObjectBuildFile( const std::string COMPILE_OPTIONS("COMPILE_OPTIONS"); if (const char* coptions = source.GetProperty(COMPILE_OPTIONS)) { - const char* evaluatedOptions = + const std::string& evaluatedOptions = genexInterpreter.Evaluate(coptions, COMPILE_OPTIONS); this->LocalGenerator->AppendCompileOptions(flags, evaluatedOptions); *this->FlagFileStream << "# Custom options: " << relativeObj @@ -468,7 +468,7 @@ void cmMakefileTargetGenerator::WriteObjectBuildFile( const std::string INCLUDE_DIRECTORIES("INCLUDE_DIRECTORIES"); if (const char* cincludes = source.GetProperty(INCLUDE_DIRECTORIES)) { - const char* evaluatedIncludes = + const std::string& evaluatedIncludes = genexInterpreter.Evaluate(cincludes, INCLUDE_DIRECTORIES); this->LocalGenerator->AppendIncludeDirectories(includes, evaluatedIncludes, source); @@ -484,7 +484,7 @@ void cmMakefileTargetGenerator::WriteObjectBuildFile( // Add source-specific preprocessor definitions. const std::string COMPILE_DEFINITIONS("COMPILE_DEFINITIONS"); if (const char* compile_defs = source.GetProperty(COMPILE_DEFINITIONS)) { - const char* evaluatedDefs = + const std::string& evaluatedDefs = genexInterpreter.Evaluate(compile_defs, COMPILE_DEFINITIONS); this->LocalGenerator->AppendDefines(defines, evaluatedDefs); *this->FlagFileStream << "# Custom defines: " << relativeObj @@ -494,7 +494,7 @@ void cmMakefileTargetGenerator::WriteObjectBuildFile( std::string defPropName = "COMPILE_DEFINITIONS_"; defPropName += configUpper; if (const char* config_compile_defs = source.GetProperty(defPropName)) { - const char* evaluatedDefs = + const std::string& evaluatedDefs = genexInterpreter.Evaluate(config_compile_defs, COMPILE_DEFINITIONS); this->LocalGenerator->AppendDefines(defines, evaluatedDefs); *this->FlagFileStream << "# Custom defines: " << relativeObj << "_DEFINES_" diff --git a/Source/cmServerProtocol.cxx b/Source/cmServerProtocol.cxx index f0a5e26..8fafeea 100644 --- a/Source/cmServerProtocol.cxx +++ b/Source/cmServerProtocol.cxx @@ -728,7 +728,7 @@ static Json::Value DumpSourceFilesList( const std::string INCLUDE_DIRECTORIES("INCLUDE_DIRECTORIES"); if (const char* cincludes = file->GetProperty(INCLUDE_DIRECTORIES)) { - const char* evaluatedIncludes = + const std::string& evaluatedIncludes = genexInterpreter.Evaluate(cincludes, INCLUDE_DIRECTORIES); lg->AppendIncludeDirectories(includes, evaluatedIncludes, *file); |