summaryrefslogtreecommitdiffstats
path: root/Source/cmCommonTargetGenerator.cxx
diff options
context:
space:
mode:
authorBrad King <brad.king@kitware.com>2015-07-09 14:05:12 (GMT)
committerBrad King <brad.king@kitware.com>2015-07-09 14:06:24 (GMT)
commit0837538e461cfdbc5c673d7f2bf64f6631099bdf (patch)
treec271915de7062275ff9f8beb9a0d0a3982ec983e /Source/cmCommonTargetGenerator.cxx
parentf4875bbdd6cc090f5c79f358c55c8b936c6254fd (diff)
downloadCMake-0837538e461cfdbc5c673d7f2bf64f6631099bdf.zip
CMake-0837538e461cfdbc5c673d7f2bf64f6631099bdf.tar.gz
CMake-0837538e461cfdbc5c673d7f2bf64f6631099bdf.tar.bz2
cmCommonTargetGenerator: Adopt GetFlags method
De-duplicate per-target flag computation in Makefile and Ninja target generators.
Diffstat (limited to 'Source/cmCommonTargetGenerator.cxx')
-rw-r--r--Source/cmCommonTargetGenerator.cxx48
1 files changed, 48 insertions, 0 deletions
diff --git a/Source/cmCommonTargetGenerator.cxx b/Source/cmCommonTargetGenerator.cxx
index afe557c..70e9ce2 100644
--- a/Source/cmCommonTargetGenerator.cxx
+++ b/Source/cmCommonTargetGenerator.cxx
@@ -284,3 +284,51 @@ std::string cmCommonTargetGenerator::GetFrameworkFlags(std::string const& l)
}
return flags;
}
+
+//----------------------------------------------------------------------------
+std::string cmCommonTargetGenerator::GetFlags(const std::string &l)
+{
+ ByLanguageMap::iterator i = this->FlagsByLanguage.find(l);
+ if (i == this->FlagsByLanguage.end())
+ {
+ std::string flags;
+ const char *lang = l.c_str();
+
+ // Add language feature flags.
+ this->AddFeatureFlags(flags, lang);
+
+ this->LocalGenerator->AddArchitectureFlags(flags, this->GeneratorTarget,
+ lang, this->ConfigName);
+
+ // Fortran-specific flags computed for this target.
+ if(l == "Fortran")
+ {
+ this->AddFortranFlags(flags);
+ }
+
+ this->LocalGenerator->AddCMP0018Flags(flags, this->Target,
+ lang, this->ConfigName);
+
+ this->LocalGenerator->AddVisibilityPresetFlags(flags, this->Target,
+ lang);
+
+ // Add include directory flags.
+ this->AddIncludeFlags(flags, lang);
+
+ // Append old-style preprocessor definition flags.
+ this->LocalGenerator->
+ AppendFlags(flags, this->Makefile->GetDefineFlags());
+
+ // Add framework directory flags.
+ this->LocalGenerator->
+ AppendFlags(flags,this->GetFrameworkFlags(l));
+
+ // Add target-specific flags.
+ this->LocalGenerator->AddCompileOptions(flags, this->Target,
+ lang, this->ConfigName);
+
+ ByLanguageMap::value_type entry(l, flags);
+ i = this->FlagsByLanguage.insert(entry).first;
+ }
+ return i->second;
+}