Merge topic 'xl-qoptfile'

c4dc6485 XL: Enable use of response files for includes and objects
e342e410 Makefile,Ninja: Use tool-specific response file flag for include dirs

Acked-by: Kitware Robot <kwrobot@kitware.com>
Merge-request: !1691
This commit is contained in:
Brad King
2018-01-25 13:36:21 +00:00
committed by Kitware Robot
3 changed files with 19 additions and 4 deletions

View File

@@ -20,6 +20,8 @@ macro(__compiler_xl lang)
# Feature flags.
set(CMAKE_${lang}_VERBOSE_FLAG "-V")
set(CMAKE_${lang}_COMPILE_OPTIONS_PIC "-qpic")
set(CMAKE_${lang}_RESPONSE_FILE_FLAG "-qoptfile=")
set(CMAKE_${lang}_RESPONSE_FILE_LINK_FLAG "-qoptfile=")
string(APPEND CMAKE_${lang}_FLAGS_DEBUG_INIT " -g")
string(APPEND CMAKE_${lang}_FLAGS_RELEASE_INIT " -O")

View File

@@ -1653,10 +1653,17 @@ void cmMakefileTargetGenerator::AddIncludeFlags(std::string& flags,
}
if (useResponseFile) {
std::string const responseFlagVar =
"CMAKE_" + lang + "_RESPONSE_FILE_FLAG";
std::string responseFlag =
this->Makefile->GetSafeDefinition(responseFlagVar);
if (responseFlag.empty()) {
responseFlag = "@";
}
std::string name = "includes_";
name += lang;
name += ".rsp";
std::string arg = "@" +
std::string arg = std::move(responseFlag) +
this->CreateResponseFile(name.c_str(), includeFlags,
this->FlagFileDepends[lang]);
this->LocalGenerator->AppendFlags(flags, arg);

View File

@@ -447,14 +447,20 @@ void cmNinjaTargetGenerator::WriteCompileRule(const std::string& lang)
std::string flags = "$FLAGS";
std::string rspfile;
std::string rspcontent;
std::string responseFlag;
bool const lang_supports_response = !(lang == "RC" || lang == "CUDA");
if (lang_supports_response && this->ForceResponseFile()) {
std::string const responseFlagVar =
"CMAKE_" + lang + "_RESPONSE_FILE_FLAG";
std::string responseFlag =
this->Makefile->GetSafeDefinition(responseFlagVar);
if (responseFlag.empty()) {
responseFlag = "@";
}
rspfile = "$RSP_FILE";
responseFlag = "@" + rspfile;
responseFlag += rspfile;
rspcontent = " $DEFINES $INCLUDES $FLAGS";
flags = responseFlag;
flags = std::move(responseFlag);
vars.Defines = "";
vars.Includes = "";
}