summaryrefslogtreecommitdiffstats
path: root/Source/cmNinjaTargetGenerator.cxx
diff options
context:
space:
mode:
authorZsolt Parragi <zsolt.parragi@cancellar.hu>2016-10-25 16:23:22 (GMT)
committerBrad King <brad.king@kitware.com>2016-10-28 15:18:03 (GMT)
commit1e4bb358946a100ea04bbc97f8195b90b44a5e9c (patch)
treeec0cebb25ef0f6fcc0d68ab8548e0d2a1f004ab3 /Source/cmNinjaTargetGenerator.cxx
parentee0f2d23fcf3cd7a67ad8d7bd132a475ed78405f (diff)
downloadCMake-1e4bb358946a100ea04bbc97f8195b90b44a5e9c.zip
CMake-1e4bb358946a100ea04bbc97f8195b90b44a5e9c.tar.gz
CMake-1e4bb358946a100ea04bbc97f8195b90b44a5e9c.tar.bz2
Add generator expression support to per-source COMPILE_FLAGS
This allows users to specify different genex-based compile flags for each file in a target, e.g. compiling just a single file with `Od/Ox` in release builds on Visual Studio.
Diffstat (limited to 'Source/cmNinjaTargetGenerator.cxx')
-rw-r--r--Source/cmNinjaTargetGenerator.cxx10
1 files changed, 8 insertions, 2 deletions
diff --git a/Source/cmNinjaTargetGenerator.cxx b/Source/cmNinjaTargetGenerator.cxx
index b48387c..cf60892 100644
--- a/Source/cmNinjaTargetGenerator.cxx
+++ b/Source/cmNinjaTargetGenerator.cxx
@@ -132,8 +132,14 @@ std::string cmNinjaTargetGenerator::ComputeFlagsForObject(
}
// Add source file specific flags.
- this->LocalGenerator->AppendFlags(flags,
- source->GetProperty("COMPILE_FLAGS"));
+ if (const char* cflags = source->GetProperty("COMPILE_FLAGS")) {
+ std::string config = this->LocalGenerator->GetConfigName();
+ cmGeneratorExpression ge;
+ CM_AUTO_PTR<cmCompiledGeneratorExpression> cge = ge.Parse(cflags);
+ const char* evaluatedFlags = cge->Evaluate(this->LocalGenerator, config,
+ false, this->GeneratorTarget);
+ this->LocalGenerator->AppendFlags(flags, evaluatedFlags);
+ }
return flags;
}