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()); target.GetName());
return; return;
} }
std::string langVar = "CMAKE_"; this->AddLanguageFlags(flags, linkLanguage, buildType.c_str());
langVar += linkLanguage;
std::string flagsVar = langVar + "_FLAGS";
std::string sharedFlagsVar = "CMAKE_SHARED_LIBRARY_"; std::string sharedFlagsVar = "CMAKE_SHARED_LIBRARY_";
sharedFlagsVar += linkLanguage; sharedFlagsVar += linkLanguage;
sharedFlagsVar += "_FLAGS"; sharedFlagsVar += "_FLAGS";
flags += this->Makefile->GetSafeDefinition(flagsVar.c_str());
flags += " "; flags += " ";
flags += this->Makefile->GetSafeDefinition(sharedFlagsVar.c_str()); flags += this->Makefile->GetSafeDefinition(sharedFlagsVar.c_str());
flags += " "; flags += " ";

View File

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