diff options
author | Marc Chevrier <marc.chevrier@sap.com> | 2017-12-01 16:10:45 (GMT) |
---|---|---|
committer | Brad King <brad.king@kitware.com> | 2017-12-04 14:10:09 (GMT) |
commit | 6bffc13ef1c85ec565273d25e811fd6c326533f0 (patch) | |
tree | 752484518da79d7edfe4ba98880f1ce7d694478c /Source/cmVisualStudio10TargetGenerator.cxx | |
parent | a4faf8638744edf7e3dd8931b55ba87e8f7738be (diff) | |
download | CMake-6bffc13ef1c85ec565273d25e811fd6c326533f0.zip CMake-6bffc13ef1c85ec565273d25e811fd6c326533f0.tar.gz CMake-6bffc13ef1c85ec565273d25e811fd6c326533f0.tar.bz2 |
Refactor per-source generator expression evaluation
Prepare to add generator expression support to more source properties.
Factor out some duplicated code into a helper to avoid further
duplication.
Diffstat (limited to 'Source/cmVisualStudio10TargetGenerator.cxx')
-rw-r--r-- | Source/cmVisualStudio10TargetGenerator.cxx | 17 |
1 files changed, 6 insertions, 11 deletions
diff --git a/Source/cmVisualStudio10TargetGenerator.cxx b/Source/cmVisualStudio10TargetGenerator.cxx index caeeeb9..3436f15 100644 --- a/Source/cmVisualStudio10TargetGenerator.cxx +++ b/Source/cmVisualStudio10TargetGenerator.cxx @@ -2062,10 +2062,8 @@ bool cmVisualStudio10TargetGenerator::OutputSourceSpecificFlags( bool configDependentFlags = false; std::string defines; if (const char* cflags = sf.GetProperty("COMPILE_FLAGS")) { - - if (cmGeneratorExpression::Find(cflags) != std::string::npos) { - configDependentFlags = true; - } + configDependentFlags = + cmGeneratorExpression::Find(cflags) != std::string::npos; flags += cflags; } if (const char* cdefs = sf.GetProperty("COMPILE_DEFINITIONS")) { @@ -2122,8 +2120,7 @@ bool cmVisualStudio10TargetGenerator::OutputSourceSpecificFlags( } // if we have flags or defines for this config then // use them - if (!flags.empty() || configDependentFlags || !configDefines.empty() || - compileAs || noWinRT) { + if (!flags.empty() || !configDefines.empty() || compileAs || noWinRT) { (*this->BuildFileStream) << firstString; firstString = ""; // only do firstString once hasFlags = true; @@ -2144,6 +2141,8 @@ bool cmVisualStudio10TargetGenerator::OutputSourceSpecificFlags( } else if (srclang == "CSharp") { flagtable = gg->GetCSharpFlagTable(); } + cmGeneratorExpressionInterpreter genexInterpreter( + this->LocalGenerator, this->GeneratorTarget, *config); cmVisualStudioGeneratorOptions clOptions( this->LocalGenerator, cmVisualStudioGeneratorOptions::Compiler, flagtable, 0, this); @@ -2154,11 +2153,7 @@ bool cmVisualStudio10TargetGenerator::OutputSourceSpecificFlags( clOptions.AddFlag("CompileAsWinRT", "false"); } if (configDependentFlags) { - cmGeneratorExpression ge; - std::unique_ptr<cmCompiledGeneratorExpression> cge = ge.Parse(flags); - std::string evaluatedFlags = cge->Evaluate( - this->LocalGenerator, *config, false, this->GeneratorTarget); - clOptions.Parse(evaluatedFlags.c_str()); + clOptions.Parse(genexInterpreter.Evaluate(flags)); } else { clOptions.Parse(flags.c_str()); } |