Ninja: move <OBJECTS> in front of the first linker option
In the response file also linker options could be passed, and because <OBJECTS> is replaced by a response file, it is necessary that no compiler option follows <OBJECTS>.
This commit is contained in:
parent
8d674e7844
commit
e31df03939
|
@ -89,8 +89,9 @@ macro(__windows_compiler_intel lang)
|
|||
set(CMAKE_${lang}_CREATE_SHARED_LIBRARY
|
||||
"xilink ${CMAKE_CL_NOLOGO} ${CMAKE_START_TEMP_FILE} /out:<TARGET> /implib:<TARGET_IMPLIB> /pdb:<TARGET_PDB> /dll <LINK_FLAGS> <OBJECTS> <LINK_LIBRARIES> ${CMAKE_END_TEMP_FILE}")
|
||||
set(CMAKE_${lang}_CREATE_SHARED_MODULE "${CMAKE_${lang}_CREATE_SHARED_LIBRARY}")
|
||||
set(CMAKE_${lang}_COMPILER_LINKER_OPTION_FLAG_EXECUTABLE "/link")
|
||||
set(CMAKE_${lang}_LINK_EXECUTABLE
|
||||
"<CMAKE_${lang}_COMPILER> ${CMAKE_CL_NOLOGO} ${CMAKE_START_TEMP_FILE} <FLAGS> <OBJECTS> /Fe<TARGET> -link /implib:<TARGET_IMPLIB> <CMAKE_${lang}_LINK_FLAGS> <LINK_FLAGS> <LINK_LIBRARIES>${CMAKE_END_TEMP_FILE}")
|
||||
"<CMAKE_${lang}_COMPILER> ${CMAKE_CL_NOLOGO} ${CMAKE_START_TEMP_FILE} <FLAGS> /Fe<TARGET> <OBJECTS> /link /implib:<TARGET_IMPLIB> <CMAKE_${lang}_LINK_FLAGS> <LINK_FLAGS> <LINK_LIBRARIES>${CMAKE_END_TEMP_FILE}")
|
||||
set(CMAKE_${lang}_FLAGS_INIT "/DWIN32 /D_WINDOWS /W3 /Zm1000${_FLAGS_${lang}}")
|
||||
set(CMAKE_${lang}_FLAGS_DEBUG_INIT "/D_DEBUG /MDd /Zi /Od /RTC1")
|
||||
set(CMAKE_${lang}_FLAGS_MINSIZEREL_INIT "/DNDEBUG /MD /O1")
|
||||
|
|
|
@ -228,9 +228,10 @@ macro(__windows_compiler_msvc lang)
|
|||
set(CMAKE_${lang}_CREATE_ASSEMBLY_SOURCE
|
||||
"<CMAKE_${lang}_COMPILER> ${CMAKE_START_TEMP_FILE} ${CMAKE_CL_NOLOGO}${_COMPILE_${lang}} <FLAGS> <DEFINES> /FoNUL /FAs /Fa<ASSEMBLY_SOURCE> /c <SOURCE>${CMAKE_END_TEMP_FILE}")
|
||||
|
||||
set(CMAKE_${lang}_COMPILER_LINKER_OPTION_FLAG_EXECUTABLE "/link")
|
||||
set(CMAKE_${lang}_USE_RESPONSE_FILE_FOR_OBJECTS 1)
|
||||
set(CMAKE_${lang}_LINK_EXECUTABLE
|
||||
"${_CMAKE_VS_LINK_EXE}<CMAKE_${lang}_COMPILER> ${CMAKE_CL_NOLOGO} <OBJECTS> ${CMAKE_START_TEMP_FILE} <FLAGS> /Fe<TARGET> /Fd<TARGET_PDB> -link /implib:<TARGET_IMPLIB> /version:<TARGET_VERSION_MAJOR>.<TARGET_VERSION_MINOR> <CMAKE_${lang}_LINK_FLAGS> <LINK_FLAGS> <LINK_LIBRARIES>${CMAKE_END_TEMP_FILE}")
|
||||
"${_CMAKE_VS_LINK_EXE}<CMAKE_${lang}_COMPILER> ${CMAKE_CL_NOLOGO} ${CMAKE_START_TEMP_FILE} <FLAGS> /Fe<TARGET> /Fd<TARGET_PDB> <OBJECTS> /link /implib:<TARGET_IMPLIB> /version:<TARGET_VERSION_MAJOR>.<TARGET_VERSION_MINOR> <CMAKE_${lang}_LINK_FLAGS> <LINK_FLAGS> <LINK_LIBRARIES>${CMAKE_END_TEMP_FILE}")
|
||||
|
||||
set(CMAKE_${lang}_FLAGS_INIT "${_PLATFORM_DEFINES}${_PLATFORM_DEFINES_${lang}} /D_WINDOWS /W3 /Zm1000${_FLAGS_${lang}}")
|
||||
set(CMAKE_${lang}_FLAGS_DEBUG_INIT "/D_DEBUG /MDd /Zi /Ob0 /Od ${_RTC1}")
|
||||
|
|
|
@ -26,8 +26,9 @@ set(CMAKE_Fortran_COMPILE_OBJECT
|
|||
|
||||
set(CMAKE_COMPILE_RESOURCE "rc <FLAGS> /fo<OBJECT> <SOURCE>")
|
||||
|
||||
set(CMAKE_${lang}_COMPILER_LINKER_OPTION_FLAG_EXECUTABLE "/link")
|
||||
set(CMAKE_Fortran_LINK_EXECUTABLE
|
||||
"<CMAKE_Fortran_COMPILER> ${CMAKE_CL_NOLOGO} ${CMAKE_START_TEMP_FILE} <FLAGS> <OBJECTS> /exe:<TARGET> /link <CMAKE_Fortran_LINK_FLAGS> <LINK_FLAGS> <LINK_LIBRARIES>${CMAKE_END_TEMP_FILE}")
|
||||
"<CMAKE_Fortran_COMPILER> ${CMAKE_CL_NOLOGO} ${CMAKE_START_TEMP_FILE} <FLAGS> /exe:<TARGET> <OBJECTS> /link <CMAKE_Fortran_LINK_FLAGS> <LINK_FLAGS> <LINK_LIBRARIES>${CMAKE_END_TEMP_FILE}")
|
||||
|
||||
set(CMAKE_CREATE_WIN32_EXE /winapp)
|
||||
set(CMAKE_CREATE_CONSOLE_EXE )
|
||||
|
|
|
@ -168,11 +168,13 @@ cmNinjaNormalTargetGenerator
|
|||
std::string responseFlag;
|
||||
if (!useResponseFile) {
|
||||
vars.Objects = "$in";
|
||||
vars.LinkLibraries = "$LINK_LIBRARIES";
|
||||
vars.LinkLibraries = "$LINK_PATH $LINK_LIBRARIES";
|
||||
} else {
|
||||
// handle response file
|
||||
std::string cmakeLinkVar = std::string("CMAKE_") +
|
||||
this->TargetLinkLanguage + "_RESPONSE_FILE_LINK_FLAG";
|
||||
std::string cmakeVarLang = "CMAKE_";
|
||||
cmakeVarLang += this->TargetLinkLanguage;
|
||||
|
||||
// build response file name
|
||||
std::string cmakeLinkVar = cmakeVarLang + "_RESPONSE_FILE_LINK_FLAG";
|
||||
const char * flag = GetMakefile()->GetDefinition(cmakeLinkVar.c_str());
|
||||
if(flag) {
|
||||
responseFlag = flag;
|
||||
|
@ -181,7 +183,14 @@ cmNinjaNormalTargetGenerator
|
|||
}
|
||||
rspfile = "$RSP_FILE";
|
||||
responseFlag += rspfile;
|
||||
rspcontent = "$in $LINK_LIBRARIES";
|
||||
|
||||
// build response file content
|
||||
std::string linkOptionVar = cmakeVarLang;
|
||||
linkOptionVar += "_COMPILER_LINKER_OPTION_FLAG_";
|
||||
linkOptionVar += cmTarget::GetTargetTypeName(targetType);
|
||||
const std::string linkOption =
|
||||
GetMakefile()->GetSafeDefinition(linkOptionVar.c_str());
|
||||
rspcontent = "$in " + linkOption + " $LINK_PATH $LINK_LIBRARIES";
|
||||
vars.Objects = responseFlag.c_str();
|
||||
vars.LinkLibraries = "";
|
||||
}
|
||||
|
@ -430,7 +439,7 @@ void cmNinjaNormalTargetGenerator::WriteLinkStatement()
|
|||
this->GetGeneratorTarget());
|
||||
|
||||
this->AddModuleDefinitionFlag(vars["LINK_FLAGS"]);
|
||||
vars["LINK_FLAGS"] += frameworkPath + linkPath;
|
||||
vars["LINK_PATH"] = frameworkPath + linkPath;
|
||||
|
||||
// Compute architecture specific link flags. Yes, these go into a different
|
||||
// variable for executables, probably due to a mistake made when duplicating
|
||||
|
@ -544,15 +553,20 @@ void cmNinjaNormalTargetGenerator::WriteLinkStatement()
|
|||
|
||||
int linkRuleLength = this->GetGlobalGenerator()->
|
||||
GetRuleCmdLength(this->LanguageLinkerRule());
|
||||
|
||||
int commandLineLengthLimit;
|
||||
if (this->GetMakefile()->IsDefinitionSet("CMAKE_FORCE_RESPONSE_FILE")) {
|
||||
commandLineLengthLimit = 1;
|
||||
} else {
|
||||
#ifdef _WIN32
|
||||
int commandLineLengthLimit = 8000 - linkRuleLength;
|
||||
commandLineLengthLimit = 8000 - linkRuleLength;
|
||||
#elif defined(__linux) || defined(__APPLE__)
|
||||
// for instance ARG_MAX is 2096152 on Ubuntu or 262144 on Mac
|
||||
int commandLineLengthLimit = ((int)sysconf(_SC_ARG_MAX))
|
||||
- linkRuleLength - 1000;
|
||||
// for instance ARG_MAX is 2096152 on Ubuntu or 262144 on Mac
|
||||
commandLineLengthLimit = ((int)sysconf(_SC_ARG_MAX))-linkRuleLength-1000;
|
||||
#else
|
||||
int commandLineLengthLimit = -1;
|
||||
commandLineLengthLimit = -1;
|
||||
#endif
|
||||
}
|
||||
|
||||
const std::string rspfile = std::string
|
||||
(cmake::GetCMakeFilesDirectoryPostSlash()) +
|
||||
|
|
Loading…
Reference in New Issue