diff options
author | Brad King <brad.king@kitware.com> | 2017-12-06 13:05:25 (GMT) |
---|---|---|
committer | Kitware Robot <kwrobot@kitware.com> | 2017-12-06 13:05:31 (GMT) |
commit | 060cf73ec8c2d5d73d698b1ff547d425d8ec7eb3 (patch) | |
tree | b244f7af1956fef9bea397cbaeb6094f46dca0e9 /Source/cmNinjaTargetGenerator.cxx | |
parent | 98206571fb68881fe373c040ae703aac318fe6d7 (diff) | |
parent | 9432f686e62082045f53bd0ec8f8911966476df1 (diff) | |
download | CMake-060cf73ec8c2d5d73d698b1ff547d425d8ec7eb3.zip CMake-060cf73ec8c2d5d73d698b1ff547d425d8ec7eb3.tar.gz CMake-060cf73ec8c2d5d73d698b1ff547d425d8ec7eb3.tar.bz2 |
Merge topic 'src-COMPILE_DEFINITIONS-genex'
9432f686 Add generator expression support to per-source COMPILE_DEFINITIONS
Acked-by: Kitware Robot <kwrobot@kitware.com>
Merge-request: !1546
Diffstat (limited to 'Source/cmNinjaTargetGenerator.cxx')
-rw-r--r-- | Source/cmNinjaTargetGenerator.cxx | 21 |
1 files changed, 14 insertions, 7 deletions
diff --git a/Source/cmNinjaTargetGenerator.cxx b/Source/cmNinjaTargetGenerator.cxx index bad4112..1036977 100644 --- a/Source/cmNinjaTargetGenerator.cxx +++ b/Source/cmNinjaTargetGenerator.cxx @@ -177,13 +177,20 @@ std::string cmNinjaTargetGenerator::ComputeDefines(cmSourceFile const* source, const std::string& language) { std::set<std::string> defines; - this->LocalGenerator->AppendDefines( - defines, source->GetProperty("COMPILE_DEFINITIONS")); - { - std::string defPropName = "COMPILE_DEFINITIONS_"; - defPropName += cmSystemTools::UpperCase(this->GetConfigName()); - this->LocalGenerator->AppendDefines(defines, - source->GetProperty(defPropName)); + const std::string config = this->LocalGenerator->GetConfigName(); + cmGeneratorExpressionInterpreter genexInterpreter( + this->LocalGenerator, this->GeneratorTarget, config); + + if (const char* compile_defs = source->GetProperty("COMPILE_DEFINITIONS")) { + this->LocalGenerator->AppendDefines( + defines, genexInterpreter.Evaluate(compile_defs)); + } + + std::string defPropName = "COMPILE_DEFINITIONS_"; + defPropName += cmSystemTools::UpperCase(config); + if (const char* config_compile_defs = source->GetProperty(defPropName)) { + this->LocalGenerator->AppendDefines( + defines, genexInterpreter.Evaluate(config_compile_defs)); } std::string definesString = this->GetDefines(language); |