Ninja: set correct LANGUAGE_COMPILE_FLAGS when linking

This commit is contained in:
Peter Kümmel 2014-04-13 14:29:20 +02:00 committed by Brad King
parent 49fcffc6cc
commit 97f2b7f5ab
1 changed files with 14 additions and 15 deletions

View File

@ -232,11 +232,9 @@ cmNinjaNormalTargetGenerator
vars.LinkFlags = "$LINK_FLAGS"; vars.LinkFlags = "$LINK_FLAGS";
std::string langFlags; std::string langFlags;
if (targetType != cmTarget::EXECUTABLE) { if (targetType != cmTarget::EXECUTABLE)
this->GetLocalGenerator()->AddLanguageFlags(langFlags, {
this->TargetLinkLanguage, langFlags += "$LANGUAGE_COMPILE_FLAGS $ARCH_FLAGS";
this->GetConfigName());
langFlags += " $ARCH_FLAGS";
vars.LanguageCompileFlags = langFlags.c_str(); vars.LanguageCompileFlags = langFlags.c_str();
} }
@ -476,21 +474,22 @@ void cmNinjaNormalTargetGenerator::WriteLinkStatement()
// Compute architecture specific link flags. Yes, these go into a different // Compute architecture specific link flags. Yes, these go into a different
// variable for executables, probably due to a mistake made when duplicating // variable for executables, probably due to a mistake made when duplicating
// code between the Makefile executable and library generators. // code between the Makefile executable and library generators.
std::string flags = (targetType == cmTarget::EXECUTABLE
? vars["FLAGS"]
: vars["ARCH_FLAGS"]);
localGen.AddArchitectureFlags(flags,
&genTarget,
this->TargetLinkLanguage,
cfgName);
if (targetType == cmTarget::EXECUTABLE) if (targetType == cmTarget::EXECUTABLE)
{ {
vars["FLAGS"] = flags; std::string t = vars["FLAGS"];
localGen.AddArchitectureFlags(t, &genTarget, TargetLinkLanguage, cfgName);
vars["FLAGS"] = t;
} }
else else
{ {
vars["ARCH_FLAGS"] = flags; std::string t = vars["ARCH_FLAGS"];
localGen.AddArchitectureFlags(t, &genTarget, TargetLinkLanguage, cfgName);
vars["ARCH_FLAGS"] = t;
t = "";
localGen.AddLanguageFlags(t, TargetLinkLanguage, cfgName);
vars["LANGUAGE_COMPILE_FLAGS"] = t;
} }
if (target.HasSOName(cfgName)) if (target.HasSOName(cfgName))
{ {
vars["SONAME_FLAG"] = mf->GetSONameFlag(this->TargetLinkLanguage); vars["SONAME_FLAG"] = mf->GetSONameFlag(this->TargetLinkLanguage);