summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorBrad King <brad.king@kitware.com>2012-09-19 17:57:47 (GMT)
committerCMake Topic Stage <kwrobot@kitware.com>2012-09-19 17:57:47 (GMT)
commit65af5e90b93c08c6241905e457bb769189eb2a21 (patch)
tree80b1922e9dd9d31b394eed9f0d712753e793845b
parentd1513950fa112692b422b25a506de9e12ff8cb01 (diff)
parenta1c9c136c33bb9370e5d6c2780817590530c9fbc (diff)
downloadCMake-65af5e90b93c08c6241905e457bb769189eb2a21.zip
CMake-65af5e90b93c08c6241905e457bb769189eb2a21.tar.gz
CMake-65af5e90b93c08c6241905e457bb769189eb2a21.tar.bz2
Merge topic 'ninja-rc-compile-flag'
a1c9c13 Ninja: filter target specific compile flags with language specific regex
-rw-r--r--Source/cmNinjaTargetGenerator.cxx40
1 files changed, 35 insertions, 5 deletions
diff --git a/Source/cmNinjaTargetGenerator.cxx b/Source/cmNinjaTargetGenerator.cxx
index 4cc23ca..385b4a0 100644
--- a/Source/cmNinjaTargetGenerator.cxx
+++ b/Source/cmNinjaTargetGenerator.cxx
@@ -167,11 +167,41 @@ cmNinjaTargetGenerator::ComputeFlagsForObject(cmSourceFile *source,
// Append old-style preprocessor definition flags.
this->LocalGenerator->AppendFlags(flags, this->Makefile->GetDefineFlags());
- // Add target-specific and source-specific flags.
- this->LocalGenerator->AppendFlags(flags,
- this->Target->GetProperty("COMPILE_FLAGS"));
- this->LocalGenerator->AppendFlags(flags,
- source->GetProperty("COMPILE_FLAGS"));
+ // Add target-specific flags.
+ if(this->Target->GetProperty("COMPILE_FLAGS"))
+ {
+ std::string langIncludeExpr = "CMAKE_";
+ langIncludeExpr += language;
+ langIncludeExpr += "_FLAG_REGEX";
+ const char* regex = this->Makefile->
+ GetDefinition(langIncludeExpr.c_str());
+ if(regex)
+ {
+ cmsys::RegularExpression r(regex);
+ std::vector<std::string> args;
+ cmSystemTools::ParseWindowsCommandLine(
+ this->Target->GetProperty("COMPILE_FLAGS"),
+ args);
+ for(std::vector<std::string>::iterator i = args.begin();
+ i != args.end(); ++i)
+ {
+ if(r.find(i->c_str()))
+ {
+ this->LocalGenerator->AppendFlags
+ (flags, i->c_str());
+ }
+ }
+ }
+ else
+ {
+ this->LocalGenerator->AppendFlags
+ (flags, this->Target->GetProperty("COMPILE_FLAGS"));
+ }
+ }
+
+ // Add source file specific flags.
+ this->LocalGenerator->AppendFlags(flags,
+ source->GetProperty("COMPILE_FLAGS"));
// TODO: Handle Apple frameworks.