mirror of
https://github.com/Kitware/CMake.git
synced 2026-05-05 05:39:57 -05:00
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:
@@ -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);
|
||||
|
||||
Reference in New Issue
Block a user