Ninja: apply CMAKE_<LANG>_FLAGS_<TYPE> to executable targets (#13069)
Based on a patch by Zaheer Chothia!
This commit is contained in:
parent
e78483c08e
commit
d807aab28f
|
@ -1548,13 +1548,10 @@ void cmLocalGenerator::GetTargetFlags(std::string& linkLibs,
|
|||
target.GetName());
|
||||
return;
|
||||
}
|
||||
std::string langVar = "CMAKE_";
|
||||
langVar += linkLanguage;
|
||||
std::string flagsVar = langVar + "_FLAGS";
|
||||
this->AddLanguageFlags(flags, linkLanguage, buildType.c_str());
|
||||
std::string sharedFlagsVar = "CMAKE_SHARED_LIBRARY_";
|
||||
sharedFlagsVar += linkLanguage;
|
||||
sharedFlagsVar += "_FLAGS";
|
||||
flags += this->Makefile->GetSafeDefinition(flagsVar.c_str());
|
||||
flags += " ";
|
||||
flags += this->Makefile->GetSafeDefinition(sharedFlagsVar.c_str());
|
||||
flags += " ";
|
||||
|
|
|
@ -193,12 +193,13 @@ cmNinjaNormalTargetGenerator
|
|||
vars.LinkFlags = "$LINK_FLAGS";
|
||||
|
||||
std::string langFlags;
|
||||
this->GetLocalGenerator()->AddLanguageFlags(langFlags,
|
||||
this->TargetLinkLanguage,
|
||||
this->GetConfigName());
|
||||
if (targetType != cmTarget::EXECUTABLE)
|
||||
if (targetType != cmTarget::EXECUTABLE) {
|
||||
this->GetLocalGenerator()->AddLanguageFlags(langFlags,
|
||||
this->TargetLinkLanguage,
|
||||
this->GetConfigName());
|
||||
langFlags += " $ARCH_FLAGS";
|
||||
vars.LanguageCompileFlags = langFlags.c_str();
|
||||
vars.LanguageCompileFlags = langFlags.c_str();
|
||||
}
|
||||
|
||||
// Rule for linking library.
|
||||
std::vector<std::string> linkCmds = this->ComputeLinkCmd();
|
||||
|
|
Loading…
Reference in New Issue