Ninja: apply CMAKE_<LANG>_FLAGS_<TYPE> to executable targets (#13069)

Based on a patch by Zaheer Chothia!
This commit is contained in:
Peter Collingbourne 2012-04-30 04:25:37 +01:00
parent e78483c08e
commit d807aab28f
2 changed files with 7 additions and 9 deletions

View File

@ -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 += " ";

View File

@ -193,12 +193,13 @@ cmNinjaNormalTargetGenerator
vars.LinkFlags = "$LINK_FLAGS";
std::string langFlags;
if (targetType != cmTarget::EXECUTABLE) {
this->GetLocalGenerator()->AddLanguageFlags(langFlags,
this->TargetLinkLanguage,
this->GetConfigName());
if (targetType != cmTarget::EXECUTABLE)
langFlags += " $ARCH_FLAGS";
vars.LanguageCompileFlags = langFlags.c_str();
}
// Rule for linking library.
std::vector<std::string> linkCmds = this->ComputeLinkCmd();