summaryrefslogtreecommitdiffstats
path: root/Source/cmExtraSublimeTextGenerator.cxx
diff options
context:
space:
mode:
authorMarc Chevrier <marc.chevrier@sap.com>2017-11-30 14:06:21 (GMT)
committerMarc Chevrier <marc.chevrier@sap.com>2017-12-05 13:47:39 (GMT)
commit9432f686e62082045f53bd0ec8f8911966476df1 (patch)
tree9e03e1ae0c08fa693fbfb741b763d45c78b5feef /Source/cmExtraSublimeTextGenerator.cxx
parentd06b8264212c893b5da8d7499328eb403aaaad37 (diff)
downloadCMake-9432f686e62082045f53bd0ec8f8911966476df1.zip
CMake-9432f686e62082045f53bd0ec8f8911966476df1.tar.gz
CMake-9432f686e62082045f53bd0ec8f8911966476df1.tar.bz2
Add generator expression support to per-source COMPILE_DEFINITIONS
This allows users to specify different genex-based compile definitions for each file in a target. Fixes: #17508
Diffstat (limited to 'Source/cmExtraSublimeTextGenerator.cxx')
-rw-r--r--Source/cmExtraSublimeTextGenerator.cxx14
1 files changed, 9 insertions, 5 deletions
diff --git a/Source/cmExtraSublimeTextGenerator.cxx b/Source/cmExtraSublimeTextGenerator.cxx
index 2443ece..bd1b6bb 100644
--- a/Source/cmExtraSublimeTextGenerator.cxx
+++ b/Source/cmExtraSublimeTextGenerator.cxx
@@ -379,6 +379,7 @@ std::string cmExtraSublimeTextGenerator::ComputeDefines(
cmMakefile* makefile = lg->GetMakefile();
const std::string& language = source->GetLanguage();
const std::string& config = makefile->GetSafeDefinition("CMAKE_BUILD_TYPE");
+ cmGeneratorExpressionInterpreter genexInterpreter(lg, target, config);
// Add the export symbol definition for shared library objects.
if (const char* exportMacro = target->GetExportMacro()) {
@@ -387,11 +388,14 @@ std::string cmExtraSublimeTextGenerator::ComputeDefines(
// Add preprocessor definitions for this target and configuration.
lg->AddCompileDefinitions(defines, target, config, language);
- lg->AppendDefines(defines, source->GetProperty("COMPILE_DEFINITIONS"));
- {
- std::string defPropName = "COMPILE_DEFINITIONS_";
- defPropName += cmSystemTools::UpperCase(config);
- lg->AppendDefines(defines, source->GetProperty(defPropName));
+ if (const char* compile_defs = source->GetProperty("COMPILE_DEFINITIONS")) {
+ lg->AppendDefines(defines, genexInterpreter.Evaluate(compile_defs));
+ }
+
+ std::string defPropName = "COMPILE_DEFINITIONS_";
+ defPropName += cmSystemTools::UpperCase(config);
+ if (const char* config_compile_defs = source->GetProperty(defPropName)) {
+ lg->AppendDefines(defines, genexInterpreter.Evaluate(config_compile_defs));
}
std::string definesString;