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

Claus Klein claus.klein at arcormail.de
Fri Jun 1 15:11:55 EDT 2012


Hi Bill,

I have tried to prepare a patch. It generates links rules like that:

# Rule for linking CXX executable.
rule CXX_EXECUTABLE_LINKER
   command = $PRE_LINK && /opt/local/libexec/ccache/g++   $FLAGS -Wl,- 
search_paths_first -Wl,-headerpad_max_install_names $LINK_FLAGS -Wl,@ 
$out.rsp  -o $out $LINK_LIBRARIES && $POST_BUILD
   description = Linking CXX executable $out
   rspfile = $out.rsp
   rspfile_content = $in

Please read carefully my comments, not all may be right now.
It may used as a prototype. I dit basic test only, it works at least  
on win32 and on my macbook. Pleas check.

Claus
-------------- next part --------------
A non-text attachment was scrubbed...
Name: NinjaGeneratorBuildCommandLine.patch
Type: application/octet-stream
Size: 631 bytes
Desc: not available
URL: <http://www.cmake.org/pipermail/cmake/attachments/20120601/6f94a848/attachment.obj>
-------------- next part --------------
A non-text attachment was scrubbed...
Name: NinjaUseResponseFile.patch
Type: application/octet-stream
Size: 6615 bytes
Desc: not available
URL: <http://www.cmake.org/pipermail/cmake/attachments/20120601/6f94a848/attachment-0001.obj>
-------------- next part --------------


On 30.05.2012, at 19:50, Bill Hoffman wrote:

> 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
> --
>
> Powered by www.kitware.com
>
> Visit other Kitware open-source projects at http://www.kitware.com/opensource/opensource.html
>
> Please keep messages on-topic and check the CMake FAQ at: http://www.cmake.org/Wiki/CMake_FAQ
>
> Follow this link to subscribe/unsubscribe:
> http://www.cmake.org/mailman/listinfo/cmake



More information about the CMake mailing list