diff options
author | Stephen Kelly <steveire@gmail.com> | 2013-03-24 20:18:39 (GMT) |
---|---|---|
committer | Brad King <brad.king@kitware.com> | 2013-03-25 14:49:22 (GMT) |
commit | a6286e92c9be9f5b8ad8fb25b3c6e15c0ec17fa0 (patch) | |
tree | 0b61fdbb1e961200371c01fe12fd5bda06b11874 /Source/cmTarget.cxx | |
parent | 8bffce955d2b906981779b39752a6836a7216c3c (diff) | |
download | CMake-a6286e92c9be9f5b8ad8fb25b3c6e15c0ec17fa0.zip CMake-a6286e92c9be9f5b8ad8fb25b3c6e15c0ec17fa0.tar.gz CMake-a6286e92c9be9f5b8ad8fb25b3c6e15c0ec17fa0.tar.bz2 |
Fix the evaluation of per-config COMPILE_DEFINITIONS (#14037)
The API for retrieving per-config COMPILE_DEFINITIONS has long
existed because of the COMPILE_DEFINITIONS_<CONFIG> style
properties. Ensure that the provided configuration being generated
is also used to evaluate the generator expressions
in cmTarget::GetCompileDefinitions.
Both the generic COMPILE_DEFINITIONS and the config-specific
variant need to be evaluated with the requested configuration. This
has the side-effect that the COMPILE_DEFINITIONS does not need to
be additionally evaluated with no configuration, so the callers can
be cleaned up a bit too.
Diffstat (limited to 'Source/cmTarget.cxx')
-rw-r--r-- | Source/cmTarget.cxx | 30 |
1 files changed, 17 insertions, 13 deletions
diff --git a/Source/cmTarget.cxx b/Source/cmTarget.cxx index 56eb4ad..732ebb2 100644 --- a/Source/cmTarget.cxx +++ b/Source/cmTarget.cxx @@ -2942,29 +2942,33 @@ std::vector<std::string> cmTarget::GetIncludeDirectories(const char *config) //---------------------------------------------------------------------------- std::string cmTarget::GetCompileDefinitions(const char *config) { - std::string defPropName = "COMPILE_DEFINITIONS"; + const char *configProp = 0; if (config) { - defPropName += "_" + cmSystemTools::UpperCase(config); + std::string configPropName; + configPropName = "COMPILE_DEFINITIONS_" + cmSystemTools::UpperCase(config); + configProp = this->GetProperty(configPropName.c_str()); } - const char *prop = this->GetProperty(defPropName.c_str()); + const char *noconfigProp = this->GetProperty("COMPILE_DEFINITIONS"); cmListFileBacktrace lfbt; cmGeneratorExpressionDAGChecker dagChecker(lfbt, this->GetName(), - defPropName, 0, 0); + "COMPILE_DEFINITIONS", 0, 0); - std::string result; - if (prop) + std::string defsString = (noconfigProp ? noconfigProp : ""); + if (configProp && noconfigProp) { - cmGeneratorExpression ge(lfbt); - - result = ge.Parse(prop)->Evaluate(this->Makefile, - config, - false, - this, - &dagChecker); + defsString += ";"; } + defsString += (configProp ? configProp : ""); + + cmGeneratorExpression ge(lfbt); + std::string result = ge.Parse(defsString.c_str())->Evaluate(this->Makefile, + config, + false, + this, + &dagChecker); std::vector<std::string> libs; this->GetDirectLinkLibraries(config, libs, this); |