From 5598d9b2a06d4ec788b5e058435bb3bba99fd517 Mon Sep 17 00:00:00 2001 From: Peter Kuemmel Date: Tue, 14 Aug 2012 15:48:45 +0200 Subject: [PATCH] Ninja: don't expand any rsp files --- Modules/Platform/Windows-Intel.cmake | 9 ++++++--- Modules/Platform/Windows-MSVC.cmake | 7 +++++-- Source/cmake.cxx | 22 +++++++++++++++------- Source/cmake.h | 3 ++- 4 files changed, 28 insertions(+), 13 deletions(-) diff --git a/Modules/Platform/Windows-Intel.cmake b/Modules/Platform/Windows-Intel.cmake index 3a30a2e0c..41e150acb 100644 --- a/Modules/Platform/Windows-Intel.cmake +++ b/Modules/Platform/Windows-Intel.cmake @@ -98,11 +98,14 @@ macro(__windows_compiler_intel lang) set(CMAKE_${lang}_FLAGS_RELWITHDEBINFO_INIT "/DNDEBUG /MD /Zi /O2") if(_INTEL_COMPILER_SUPPORTS_MANIFEST) + if(CMAKE_GENERATOR MATCHES "Ninja") + set(NO_RSP_EXPAND _no_rsp_expand) + endif() set(CMAKE_${lang}_LINK_EXECUTABLE - " -E vs_link_exe ${CMAKE_${lang}_LINK_EXECUTABLE}") + " -E vs_link_exe${NO_RSP_EXPAND} ${CMAKE_${lang}_LINK_EXECUTABLE}") set(CMAKE_${lang}_CREATE_SHARED_LIBRARY - " -E vs_link_dll ${CMAKE_${lang}_CREATE_SHARED_LIBRARY}") + " -E vs_link_dll${NO_RSP_EXPAND} ${CMAKE_${lang}_CREATE_SHARED_LIBRARY}") set(CMAKE_${lang}_CREATE_SHARED_MODULE - " -E vs_link_dll ${CMAKE_${lang}_CREATE_SHARED_MODULE}") + " -E vs_link_dll${NO_RSP_EXPAND} ${CMAKE_${lang}_CREATE_SHARED_MODULE}") endif() endmacro() diff --git a/Modules/Platform/Windows-MSVC.cmake b/Modules/Platform/Windows-MSVC.cmake index cc48cfe29..da0dba99c 100644 --- a/Modules/Platform/Windows-MSVC.cmake +++ b/Modules/Platform/Windows-MSVC.cmake @@ -212,8 +212,11 @@ set (CMAKE_MODULE_LINKER_FLAGS_MINSIZEREL_INIT ${CMAKE_EXE_LINKER_FLAGS_MINSIZER macro(__windows_compiler_msvc lang) if(NOT "${CMAKE_${lang}_COMPILER_VERSION}" VERSION_LESS 14) # for 2005 make sure the manifest is put in the dll with mt - set(_CMAKE_VS_LINK_DLL " -E vs_link_dll ") - set(_CMAKE_VS_LINK_EXE " -E vs_link_exe ") + if(CMAKE_GENERATOR MATCHES "Ninja") + set(NO_RSP_EXPAND _no_rsp_expand) + endif() + set(_CMAKE_VS_LINK_DLL " -E vs_link_dll${NO_RSP_EXPAND} ") + set(_CMAKE_VS_LINK_EXE " -E vs_link_exe${NO_RSP_EXPAND} ") endif() set(CMAKE_${lang}_CREATE_SHARED_LIBRARY "${_CMAKE_VS_LINK_DLL} ${CMAKE_CL_NOLOGO} ${CMAKE_START_TEMP_FILE} /out: /implib: /pdb: /dll /version:. ${CMAKE_END_TEMP_FILE}") diff --git a/Source/cmake.cxx b/Source/cmake.cxx index c6787b9d0..14f15668c 100644 --- a/Source/cmake.cxx +++ b/Source/cmake.cxx @@ -1682,11 +1682,19 @@ int cmake::ExecuteCMakeCommand(std::vector& args) } else if (args[1] == "vs_link_exe") { - return cmake::VisualStudioLink(args, 1); + return cmake::VisualStudioLink(args, 1, false); } else if (args[1] == "vs_link_dll") { - return cmake::VisualStudioLink(args, 2); + return cmake::VisualStudioLink(args, 2, false); + } + else if (args[1] == "vs_link_exe_no_rsp_expand") + { + return cmake::VisualStudioLink(args, 1, true); + } + else if (args[1] == "vs_link_dll_no_rsp_expand") + { + return cmake::VisualStudioLink(args, 2, true); } #ifdef CMAKE_BUILD_WITH_CMAKE // Internal CMake color makefile support. @@ -4009,7 +4017,8 @@ static bool cmakeCheckStampList(const char* stampList) // For visual studio 2005 and newer manifest files need to be embeded into // exe and dll's. This code does that in such a way that incremental linking // still works. -int cmake::VisualStudioLink(std::vector& args, int type) +int cmake::VisualStudioLink(std::vector& args, int type, + bool no_rsp_expand) { if(args.size() < 2) { @@ -4024,13 +4033,12 @@ int cmake::VisualStudioLink(std::vector& args, int type) for(std::vector::iterator i = args.begin(); i != args.end(); ++i) { - // check for nmake temporary files - if((*i)[0] == '@' && i->find("@CMakeFiles") != 0 ) + // check for nmake temporary files (there are two rsp files) + if(!no_rsp_expand && (*i)[0] == '@' && i->find("@CMakeFiles") != 0 ) { std::ifstream fin(i->substr(1).c_str()); std::string line; - while(cmSystemTools::GetLineFromStream(fin, - line)) + while(cmSystemTools::GetLineFromStream(fin, line)) { cmSystemTools::ParseWindowsCommandLine(line.c_str(), expandedArgs); } diff --git a/Source/cmake.h b/Source/cmake.h index 94c6f128f..12e5edffc 100644 --- a/Source/cmake.h +++ b/Source/cmake.h @@ -447,7 +447,8 @@ protected: std::string const& link); static int ExecuteEchoColor(std::vector& args); static int ExecuteLinkScript(std::vector& args); - static int VisualStudioLink(std::vector& args, int type); + static int VisualStudioLink(std::vector& args, int type, + bool no_rsp_expand); static int VisualStudioLinkIncremental(std::vector& args, int type, bool verbose);