From 57df2abca804dd8e98d000441fc0035eef9d4829 Mon Sep 17 00:00:00 2001 From: Brad King Date: Fri, 2 Oct 2009 13:51:49 -0400 Subject: Centralize language flag addition for Makefiles We create cmMakefileTargetGenerator::AddFeatureFlags to consolidate addition of language flags. Currently it just adds the flags from generic per-language flag variables (AddLanguageFlags). --- Source/cmMakefileExecutableTargetGenerator.cxx | 5 ++--- Source/cmMakefileLibraryTargetGenerator.cxx | 6 ++++-- Source/cmMakefileTargetGenerator.cxx | 15 +++++++++++---- Source/cmMakefileTargetGenerator.h | 3 +++ 4 files changed, 20 insertions(+), 9 deletions(-) diff --git a/Source/cmMakefileExecutableTargetGenerator.cxx b/Source/cmMakefileExecutableTargetGenerator.cxx index c7213a6..16e2266 100644 --- a/Source/cmMakefileExecutableTargetGenerator.cxx +++ b/Source/cmMakefileExecutableTargetGenerator.cxx @@ -231,9 +231,8 @@ void cmMakefileExecutableTargetGenerator::WriteExecutableRule(bool relink) (linkFlags, this->Makefile->GetDefinition(export_flag_var.c_str())); } - // Add language-specific flags. - this->LocalGenerator - ->AddLanguageFlags(flags, linkLanguage, this->ConfigName); + // Add language feature flags. + this->AddFeatureFlags(flags, linkLanguage); // Add target-specific linker flags. this->LocalGenerator->AppendFlags diff --git a/Source/cmMakefileLibraryTargetGenerator.cxx b/Source/cmMakefileLibraryTargetGenerator.cxx index 9162b4c..24b037f 100644 --- a/Source/cmMakefileLibraryTargetGenerator.cxx +++ b/Source/cmMakefileLibraryTargetGenerator.cxx @@ -671,9 +671,11 @@ void cmMakefileLibraryTargetGenerator::WriteLibraryRules vars.TargetInstallNameDir = install_name_dir.c_str(); } } + + // Add language feature flags. std::string langFlags; - this->LocalGenerator - ->AddLanguageFlags(langFlags, linkLanguage, this->ConfigName); + this->AddFeatureFlags(langFlags, linkLanguage); + // remove any language flags that might not work with the // particular os if(forbiddenFlagVar) diff --git a/Source/cmMakefileTargetGenerator.cxx b/Source/cmMakefileTargetGenerator.cxx index edfae87..719aa50 100644 --- a/Source/cmMakefileTargetGenerator.cxx +++ b/Source/cmMakefileTargetGenerator.cxx @@ -291,10 +291,8 @@ void cmMakefileTargetGenerator::WriteTargetLanguageFlags() this->LocalGenerator->AppendDefines (defines, this->Target->GetProperty(defPropName.c_str()), lang); - // Add language-specific flags. - this->LocalGenerator - ->AddLanguageFlags(flags, lang, - this->LocalGenerator->ConfigurationName.c_str()); + // Add language feature flags. + this->AddFeatureFlags(flags, lang); // Fortran-specific flags computed for this target. if(*l == "Fortran") @@ -1762,3 +1760,12 @@ void cmMakefileTargetGenerator::AddModuleDefinitionFlag(std::string& flags) this->ModuleDefinitionFile.c_str())); this->LocalGenerator->AppendFlags(flags, flag.c_str()); } + +//---------------------------------------------------------------------------- +void cmMakefileTargetGenerator::AddFeatureFlags( + std::string& flags, const char* lang + ) +{ + // Add language-specific flags. + this->LocalGenerator->AddLanguageFlags(flags, lang, this->ConfigName); +} diff --git a/Source/cmMakefileTargetGenerator.h b/Source/cmMakefileTargetGenerator.h index 6878e06..d72bdce 100644 --- a/Source/cmMakefileTargetGenerator.h +++ b/Source/cmMakefileTargetGenerator.h @@ -220,6 +220,9 @@ protected: // Helper to add flag for windows .def file. void AddModuleDefinitionFlag(std::string& flags); + // Add language feature flags. + void AddFeatureFlags(std::string& flags, const char* lang); + //================================================================== // Convenience routines that do nothing more than forward to // implementaitons -- cgit v0.12