From e342e4100a597dc8a7f94c55409e619a4848754f Mon Sep 17 00:00:00 2001 From: Brad King Date: Wed, 24 Jan 2018 10:28:09 -0500 Subject: Makefile,Ninja: Use tool-specific response file flag for include dirs When we use a response file for `-I` flags, not all compilers support the `@` syntax. Define `CMAKE__RESPONSE_FILE_FLAG` to specify tool-specific flag, just as we do for linking already via `CMAKE__RESPONSE_FILE_LINK_FLAG`. --- Source/cmMakefileTargetGenerator.cxx | 9 ++++++++- Source/cmNinjaTargetGenerator.cxx | 12 +++++++++--- 2 files changed, 17 insertions(+), 4 deletions(-) diff --git a/Source/cmMakefileTargetGenerator.cxx b/Source/cmMakefileTargetGenerator.cxx index 002cc0f..aba69d0 100644 --- a/Source/cmMakefileTargetGenerator.cxx +++ b/Source/cmMakefileTargetGenerator.cxx @@ -1625,10 +1625,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); diff --git a/Source/cmNinjaTargetGenerator.cxx b/Source/cmNinjaTargetGenerator.cxx index f967168..debf476 100644 --- a/Source/cmNinjaTargetGenerator.cxx +++ b/Source/cmNinjaTargetGenerator.cxx @@ -416,14 +416,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 = ""; } -- cgit v0.12 From c4dc6485eb3bd51fdc88eee03218b9755c373282 Mon Sep 17 00:00:00 2001 From: Brad King Date: Wed, 24 Jan 2018 10:34:53 -0500 Subject: XL: Enable use of response files for includes and objects The IBM XL compiler supports response files via `-qoptfile=` instead of `@`. --- Modules/Compiler/XL.cmake | 2 ++ 1 file changed, 2 insertions(+) diff --git a/Modules/Compiler/XL.cmake b/Modules/Compiler/XL.cmake index 4783785..e527a04 100644 --- a/Modules/Compiler/XL.cmake +++ b/Modules/Compiler/XL.cmake @@ -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") -- cgit v0.12