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).
This commit is contained in:
Brad King 2009-10-02 13:51:49 -04:00
parent d455eeb6d7
commit 57df2abca8
4 changed files with 20 additions and 9 deletions

View File

@ -231,9 +231,8 @@ void cmMakefileExecutableTargetGenerator::WriteExecutableRule(bool relink)
(linkFlags, this->Makefile->GetDefinition(export_flag_var.c_str())); (linkFlags, this->Makefile->GetDefinition(export_flag_var.c_str()));
} }
// Add language-specific flags. // Add language feature flags.
this->LocalGenerator this->AddFeatureFlags(flags, linkLanguage);
->AddLanguageFlags(flags, linkLanguage, this->ConfigName);
// Add target-specific linker flags. // Add target-specific linker flags.
this->LocalGenerator->AppendFlags this->LocalGenerator->AppendFlags

View File

@ -671,9 +671,11 @@ void cmMakefileLibraryTargetGenerator::WriteLibraryRules
vars.TargetInstallNameDir = install_name_dir.c_str(); vars.TargetInstallNameDir = install_name_dir.c_str();
} }
} }
// Add language feature flags.
std::string langFlags; std::string langFlags;
this->LocalGenerator this->AddFeatureFlags(langFlags, linkLanguage);
->AddLanguageFlags(langFlags, linkLanguage, this->ConfigName);
// remove any language flags that might not work with the // remove any language flags that might not work with the
// particular os // particular os
if(forbiddenFlagVar) if(forbiddenFlagVar)

View File

@ -291,10 +291,8 @@ void cmMakefileTargetGenerator::WriteTargetLanguageFlags()
this->LocalGenerator->AppendDefines this->LocalGenerator->AppendDefines
(defines, this->Target->GetProperty(defPropName.c_str()), lang); (defines, this->Target->GetProperty(defPropName.c_str()), lang);
// Add language-specific flags. // Add language feature flags.
this->LocalGenerator this->AddFeatureFlags(flags, lang);
->AddLanguageFlags(flags, lang,
this->LocalGenerator->ConfigurationName.c_str());
// Fortran-specific flags computed for this target. // Fortran-specific flags computed for this target.
if(*l == "Fortran") if(*l == "Fortran")
@ -1762,3 +1760,12 @@ void cmMakefileTargetGenerator::AddModuleDefinitionFlag(std::string& flags)
this->ModuleDefinitionFile.c_str())); this->ModuleDefinitionFile.c_str()));
this->LocalGenerator->AppendFlags(flags, flag.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);
}

View File

@ -220,6 +220,9 @@ protected:
// Helper to add flag for windows .def file. // Helper to add flag for windows .def file.
void AddModuleDefinitionFlag(std::string& flags); 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 // Convenience routines that do nothing more than forward to
// implementaitons // implementaitons