diff options
-rw-r--r-- | Source/cmCommonTargetGenerator.cxx | 33 | ||||
-rw-r--r-- | Source/cmLocalGenerator.cxx | 27 | ||||
-rw-r--r-- | Source/cmLocalGenerator.h | 3 |
3 files changed, 32 insertions, 31 deletions
diff --git a/Source/cmCommonTargetGenerator.cxx b/Source/cmCommonTargetGenerator.cxx index aa7f5c0..101093d 100644 --- a/Source/cmCommonTargetGenerator.cxx +++ b/Source/cmCommonTargetGenerator.cxx @@ -120,38 +120,9 @@ 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->LocalGenerator->AppendFlags( - flags, this->LocalGenerator->GetTargetFortranFlags( - this->GeneratorTarget, this->ConfigName)); - } - - this->LocalGenerator->AddCMP0018Flags(flags, this->GeneratorTarget, lang, - this->ConfigName); - - this->LocalGenerator->AddVisibilityPresetFlags( - flags, this->GeneratorTarget, lang); - - // Append old-style preprocessor definition flags. - this->LocalGenerator->AppendFlags(flags, this->Makefile->GetDefineFlags()); - - // Add framework directory flags. - this->LocalGenerator->AppendFlags( - flags, this->LocalGenerator->GetFrameworkFlags(l, this->ConfigName, - this->GeneratorTarget)); - - // Add target-specific flags. - this->LocalGenerator->AddCompileOptions(flags, this->GeneratorTarget, lang, - this->ConfigName); + this->LocalGenerator->GetTargetCompileFlags(this->GeneratorTarget, + this->ConfigName, l, flags); ByLanguageMap::value_type entry(l, flags); i = this->FlagsByLanguage.insert(entry).first; diff --git a/Source/cmLocalGenerator.cxx b/Source/cmLocalGenerator.cxx index a0263e4..e2e7aa1 100644 --- a/Source/cmLocalGenerator.cxx +++ b/Source/cmLocalGenerator.cxx @@ -1272,6 +1272,33 @@ void cmLocalGenerator::GetTargetFlags( } } +void cmLocalGenerator::GetTargetCompileFlags(cmGeneratorTarget* target, + std::string const& config, + std::string const& lang, + std::string& flags) +{ + cmMakefile* mf = this->GetMakefile(); + + // Add language-specific flags. + this->AddLanguageFlags(flags, lang, config); + + if (target->GetFeatureAsBool("INTERPROCEDURAL_OPTIMIZATION", config)) { + this->AppendFeatureOptions(flags, lang, "IPO"); + } + + this->AddArchitectureFlags(flags, target, lang, config); + + if (lang == "Fortran") { + this->AppendFlags(flags, this->GetTargetFortranFlags(target, config)); + } + + this->AddCMP0018Flags(flags, target, lang, config); + this->AddVisibilityPresetFlags(flags, target, lang); + this->AppendFlags(flags, mf->GetDefineFlags()); + this->AppendFlags(flags, this->GetFrameworkFlags(lang, config, target)); + this->AddCompileOptions(flags, target, lang, config); +} + static std::string GetFrameworkFlags(const std::string& lang, const std::string& config, cmGeneratorTarget* target) diff --git a/Source/cmLocalGenerator.h b/Source/cmLocalGenerator.h index d04a723..66fbe01 100644 --- a/Source/cmLocalGenerator.h +++ b/Source/cmLocalGenerator.h @@ -317,6 +317,9 @@ public: void GetTargetDefines(cmGeneratorTarget const* target, std::string const& config, std::string const& lang, std::set<std::string>& defines) const; + void GetTargetCompileFlags(cmGeneratorTarget* target, + std::string const& config, + std::string const& lang, std::string& flags); std::string GetFrameworkFlags(std::string const& l, std::string const& config, |