summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorBrad King <brad.king@kitware.com>2012-10-02 14:06:54 (GMT)
committerCMake Topic Stage <kwrobot@kitware.com>2012-10-02 14:06:54 (GMT)
commit851a3a0b750cde77ae6cb0895fac1e19e020c05e (patch)
tree4172158846684998934e203053ecf10e8e74177b
parent3aa15d62f873161e8cbce5d4855101daefd971ab (diff)
parentdbd99d6fbbdf76181ac01ec9cc32fd3b67a4ce7c (diff)
downloadCMake-851a3a0b750cde77ae6cb0895fac1e19e020c05e.zip
CMake-851a3a0b750cde77ae6cb0895fac1e19e020c05e.tar.gz
CMake-851a3a0b750cde77ae6cb0895fac1e19e020c05e.tar.bz2
Merge topic 'ninja-link-rsp-expand'
dbd99d6 Revert "Ninja: don't expand any rsp files" f1670ab Ninja: don't confuse ninja's rsp files with nmake's
-rw-r--r--Modules/Platform/Windows-Intel.cmake9
-rw-r--r--Modules/Platform/Windows-MSVC.cmake7
-rw-r--r--Source/cmGlobalNinjaGenerator.cxx12
-rw-r--r--Source/cmGlobalNinjaGenerator.h1
-rw-r--r--Source/cmNinjaNormalTargetGenerator.cxx9
-rw-r--r--Source/cmake.cxx22
-rw-r--r--Source/cmake.h3
7 files changed, 30 insertions, 33 deletions
diff --git a/Modules/Platform/Windows-Intel.cmake b/Modules/Platform/Windows-Intel.cmake
index 41e150a..3a30a2e 100644
--- a/Modules/Platform/Windows-Intel.cmake
+++ b/Modules/Platform/Windows-Intel.cmake
@@ -98,14 +98,11 @@ 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
- "<CMAKE_COMMAND> -E vs_link_exe${NO_RSP_EXPAND} ${CMAKE_${lang}_LINK_EXECUTABLE}")
+ "<CMAKE_COMMAND> -E vs_link_exe ${CMAKE_${lang}_LINK_EXECUTABLE}")
set(CMAKE_${lang}_CREATE_SHARED_LIBRARY
- "<CMAKE_COMMAND> -E vs_link_dll${NO_RSP_EXPAND} ${CMAKE_${lang}_CREATE_SHARED_LIBRARY}")
+ "<CMAKE_COMMAND> -E vs_link_dll ${CMAKE_${lang}_CREATE_SHARED_LIBRARY}")
set(CMAKE_${lang}_CREATE_SHARED_MODULE
- "<CMAKE_COMMAND> -E vs_link_dll${NO_RSP_EXPAND} ${CMAKE_${lang}_CREATE_SHARED_MODULE}")
+ "<CMAKE_COMMAND> -E vs_link_dll ${CMAKE_${lang}_CREATE_SHARED_MODULE}")
endif()
endmacro()
diff --git a/Modules/Platform/Windows-MSVC.cmake b/Modules/Platform/Windows-MSVC.cmake
index da0dba9..cc48cfe 100644
--- a/Modules/Platform/Windows-MSVC.cmake
+++ b/Modules/Platform/Windows-MSVC.cmake
@@ -212,11 +212,8 @@ 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
- if(CMAKE_GENERATOR MATCHES "Ninja")
- set(NO_RSP_EXPAND _no_rsp_expand)
- endif()
- set(_CMAKE_VS_LINK_DLL "<CMAKE_COMMAND> -E vs_link_dll${NO_RSP_EXPAND} ")
- set(_CMAKE_VS_LINK_EXE "<CMAKE_COMMAND> -E vs_link_exe${NO_RSP_EXPAND} ")
+ set(_CMAKE_VS_LINK_DLL "<CMAKE_COMMAND> -E vs_link_dll ")
+ set(_CMAKE_VS_LINK_EXE "<CMAKE_COMMAND> -E vs_link_exe ")
endif()
set(CMAKE_${lang}_CREATE_SHARED_LIBRARY
"${_CMAKE_VS_LINK_DLL}<CMAKE_LINKER> ${CMAKE_CL_NOLOGO} <OBJECTS> ${CMAKE_START_TEMP_FILE} /out:<TARGET> /implib:<TARGET_IMPLIB> /pdb:<TARGET_PDB> /dll /version:<TARGET_VERSION_MAJOR>.<TARGET_VERSION_MINOR> <LINK_FLAGS> <LINK_LIBRARIES> ${CMAKE_END_TEMP_FILE}")
diff --git a/Source/cmGlobalNinjaGenerator.cxx b/Source/cmGlobalNinjaGenerator.cxx
index 3f3cfbb..05f5b4c 100644
--- a/Source/cmGlobalNinjaGenerator.cxx
+++ b/Source/cmGlobalNinjaGenerator.cxx
@@ -106,6 +106,7 @@ void cmGlobalNinjaGenerator::WriteBuild(std::ostream& os,
const cmNinjaDeps& implicitDeps,
const cmNinjaDeps& orderOnlyDeps,
const cmNinjaVars& variables,
+ const std::string& rspfile,
int cmdLineLimit)
{
// Make sure there is a rule.
@@ -181,12 +182,17 @@ void cmGlobalNinjaGenerator::WriteBuild(std::ostream& os,
// check if a response file rule should be used
std::string buildstr = build.str();
- const std::string assignments = variable_assignments.str();
+ std::string assignments = variable_assignments.str();
const std::string args = arguments.str();
if (cmdLineLimit > 0
&& args.size() + buildstr.size() + assignments.size()
- > (size_t) cmdLineLimit)
- buildstr += "_RSPFILE";
+ > (size_t) cmdLineLimit) {
+ buildstr += "_RSP_FILE";
+ variable_assignments.clear();
+ cmGlobalNinjaGenerator::WriteVariable(variable_assignments,
+ "RSP_FILE", rspfile, "", 1);
+ assignments += variable_assignments.str();
+ }
os << buildstr << args << assignments;
}
diff --git a/Source/cmGlobalNinjaGenerator.h b/Source/cmGlobalNinjaGenerator.h
index b2fe243..24c3916 100644
--- a/Source/cmGlobalNinjaGenerator.h
+++ b/Source/cmGlobalNinjaGenerator.h
@@ -84,6 +84,7 @@ public:
const cmNinjaDeps& implicitDeps,
const cmNinjaDeps& orderOnlyDeps,
const cmNinjaVars& variables,
+ const std::string& rspfile = std::string(),
int cmdLineLimit = -1);
/**
diff --git a/Source/cmNinjaNormalTargetGenerator.cxx b/Source/cmNinjaNormalTargetGenerator.cxx
index 6f991e2..a13e1f0 100644
--- a/Source/cmNinjaNormalTargetGenerator.cxx
+++ b/Source/cmNinjaNormalTargetGenerator.cxx
@@ -153,7 +153,7 @@ cmNinjaNormalTargetGenerator
cmTarget::TargetType targetType = this->GetTarget()->GetType();
std::string ruleName = this->LanguageLinkerRule();
if (useResponseFile)
- ruleName += "_RSPFILE";
+ ruleName += "_RSP_FILE";
// Select whether to use a response file for objects.
std::string rspfile;
@@ -179,7 +179,7 @@ cmNinjaNormalTargetGenerator
} else {
responseFlag = "@";
}
- rspfile = "$out.rsp";
+ rspfile = "$RSP_FILE";
responseFlag += rspfile;
rspcontent = "$in $LINK_LIBRARIES";
vars.Objects = responseFlag.c_str();
@@ -549,6 +549,10 @@ void cmNinjaNormalTargetGenerator::WriteLinkStatement()
int commandLineLengthLimit = -1;
#endif
+ const std::string rspfile = std::string
+ (cmake::GetCMakeFilesDirectoryPostSlash()) +
+ this->GetTarget()->GetName() + ".rsp";
+
// Write the build statement for this target.
cmGlobalNinjaGenerator::WriteBuild(this->GetBuildFileStream(),
comment.str(),
@@ -558,6 +562,7 @@ void cmNinjaNormalTargetGenerator::WriteLinkStatement()
implicitDeps,
emptyDeps,
vars,
+ rspfile,
commandLineLengthLimit);
if (targetOutput != targetOutputReal) {
diff --git a/Source/cmake.cxx b/Source/cmake.cxx
index 6cb7aa4..745d513 100644
--- a/Source/cmake.cxx
+++ b/Source/cmake.cxx
@@ -1683,19 +1683,11 @@ int cmake::ExecuteCMakeCommand(std::vector<std::string>& args)
}
else if (args[1] == "vs_link_exe")
{
- return cmake::VisualStudioLink(args, 1, false);
+ return cmake::VisualStudioLink(args, 1);
}
else if (args[1] == "vs_link_dll")
{
- 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);
+ return cmake::VisualStudioLink(args, 2);
}
#ifdef CMAKE_BUILD_WITH_CMAKE
// Internal CMake color makefile support.
@@ -4021,8 +4013,7 @@ 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<std::string>& args, int type,
- bool no_rsp_expand)
+int cmake::VisualStudioLink(std::vector<std::string>& args, int type)
{
if(args.size() < 2)
{
@@ -4037,12 +4028,13 @@ int cmake::VisualStudioLink(std::vector<std::string>& args, int type,
for(std::vector<std::string>::iterator i = args.begin();
i != args.end(); ++i)
{
- // check for nmake temporary files (there are two rsp files)
- if(!no_rsp_expand && (*i)[0] == '@' && i->find("@CMakeFiles") != 0 )
+ // check for nmake temporary files
+ if((*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 12e5edf..94c6f12 100644
--- a/Source/cmake.h
+++ b/Source/cmake.h
@@ -447,8 +447,7 @@ protected:
std::string const& link);
static int ExecuteEchoColor(std::vector<std::string>& args);
static int ExecuteLinkScript(std::vector<std::string>& args);
- static int VisualStudioLink(std::vector<std::string>& args, int type,
- bool no_rsp_expand);
+ static int VisualStudioLink(std::vector<std::string>& args, int type);
static int VisualStudioLinkIncremental(std::vector<std::string>& args,
int type,
bool verbose);