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

Bill Hoffman bill.hoffman at kitware.com
Wed May 30 13:50:21 EDT 2012


On 5/30/2012 1:07 PM, Peter Kuemmel wrote:
>
>>
>> The cmake code needs to be updated to use the native ninja response
>> files.   If you are interested in this work, I can help you figure out
>> where to make the changes.
>>
>> -Bill
>
> Have you started working on this? And is there somewhere already a branch?
> If not, where is the best place for such a branch, github or stage?
>
> Peter
No, no not much actual work...


However, what needs to be done is this:

http://martine.github.com/ninja/manual.html#_rule_variables
rspfile, rspfile_content
rule link
   command = link.exe /OUT$out [usual link flags here] @$out.rsp
   rspfile = $out.rsp
   rspfile_content = $in

We have to add this code to the cmNinjaNormalTargetGenerator.cxx

I think this method will also have to be updated to know about rspfiles:
cmGlobalNinjaGenerator::WriteRule


Claus did this by hand and it worked:

rule CXX_EXECUTABLE_LINKER
   #XXX command = cmd.exe /c $PRE_LINK && 
C:\Programme\CMake2.8\bin\cmake.exe -E vs_link_exe 
c:\PROGRA~1\MICROS~4\VC\bin\link.exe /nologo /OUT:$out /DEBUG 
/PDB:$TARGET_PDB /IMPLIB:$TARGET_IMPLIB /version:0.0  @$out.rsp && 
$POST_BUILD
   command = cmd.exe /c $PRE_LINK && 
C:\PROGRA~1\MICROS~4\VC\bin\link.exe /nologo /OUT:$out /DEBUG 
/PDB:$TARGET_PDB /IMPLIB:$TARGET_IMPLIB /version:0.0  @$out.rsp && 
$POST_BUILD
   description = Linking CXX executable $out
   rspfile = $out.rsp
   rspfile_content = $FLAGS $LINK_FLAGS $LINK_LIBRARIES $in



-- 
Bill Hoffman
Kitware, Inc.
28 Corporate Drive
Clifton Park, NY 12065
bill.hoffman at kitware.com
http://www.kitware.com
518 881-4905 (Direct)
518 371-3971 x105
Fax (518) 371-4573


More information about the CMake mailing list