[cmake-developers] [CMake] Nina Generator on Windows generates too long link cmd lines

Peter Kümmel syntheticpp at gmx.net
Tue Jun 5 18:15:17 EDT 2012


On 04.06.2012 23:13, Bill Hoffman wrote:
> On 6/4/2012 2:22 PM, Peter Kümmel wrote:
>> We use ninja's response files:
>>
>> # Rule for linking CXX static library.
>> rule CXX_STATIC_LIBRARY_LINKER
>>     command = E:\sandbox\MinGW32\bin\ar.exe cr $out $LINK_FLAGS @$out.rsp
>>     description = Linking CXX static library $out
>>     rspfile = $out.rsp
>>     rspfile_content = $in
>>
>> But the problem is, that ar under windows doesn't like paths with one single '\'
>>
>> and on some UNIXs doesn't support response files at all.
> OK, my mistake.  The tool has to support response files.  So, currently
> with nmake files we do something like this:
>
> Platform/Windows.cmake:
> # for nmake make long command lines are redirected to a file
> # with the following syntax, see Windows-bcc32.cmake for use
> IF(CMAKE_GENERATOR MATCHES "NMake")
>     SET(CMAKE_START_TEMP_FILE "@<<\n")
>     SET(CMAKE_END_TEMP_FILE "\n<<")
> ENDIF(CMAKE_GENERATOR MATCHES "NMake")
>
>
> Does MinGW32 ar use a different format response file than MS link.exe?
> Seems like this should go in the Platform file.  Maybe we don't use it
> on UNIX?
>
> -Bill
> --

I found the problem: using CMAKE_C_USE_RESPONSE_FILE_FOR_OBJECTS was wrong.

I've fixed the patch:
1. also write rules with response files enabled
2. then the command line length is checked by cmake and if it
     is too long the rule with the response file is used
3. when MinGW is used the "slashed" pathes are used because ar.exe can't
     read  \ in response files.

The commits are here

http://cmake.org/gitweb?p=stage/cmake.git;a=shortlog;h=refs/heads/ninja-rspfile

and I've merged it into next.

Peter



More information about the cmake-developers mailing list