cmLocalGenerator: Add a hook for compiler flags used at link time

When using a compiler to drive linking we add compiler flags from
`CMAKE_<LANG>_FLAGS` in case they affect the way the compiler invokes
the linker, but we don't add flags from other places that are meant only
for compiling sources.  Rather than calling the `AddLanguageFlags`
method (which is used to add flags for compiling sources) directly, add
an intermediate method that is used when adding the flags for linking.
This will give us a way to add language-specific compiler flags needed
when driving the linker in the same place on the command line as other
compiler flags go.
This commit is contained in:
Brad King
2017-04-28 14:30:00 -04:00
parent b115bc49ff
commit d037be122e
5 changed files with 24 additions and 11 deletions
+4 -4
View File
@@ -397,8 +397,8 @@ void cmMakefileLibraryTargetGenerator::WriteDeviceLibraryRules(
// Add language-specific flags.
std::string langFlags;
this->LocalGenerator->AddLanguageFlags(langFlags, this->GeneratorTarget,
linkLanguage, this->ConfigName);
this->LocalGenerator->AddLanguageFlagsForLinking(
langFlags, this->GeneratorTarget, linkLanguage, this->ConfigName);
vars.LanguageCompileFlags = langFlags.c_str();
@@ -858,8 +858,8 @@ void cmMakefileLibraryTargetGenerator::WriteLibraryRules(
// Add language-specific flags.
std::string langFlags;
this->LocalGenerator->AddLanguageFlags(langFlags, this->GeneratorTarget,
linkLanguage, this->ConfigName);
this->LocalGenerator->AddLanguageFlagsForLinking(
langFlags, this->GeneratorTarget, linkLanguage, this->ConfigName);
this->LocalGenerator->AddArchitectureFlags(
langFlags, this->GeneratorTarget, linkLanguage, this->ConfigName);