[CMake] 'command line too long' when path contains a special character

Scott Elliott Scott.Elliott at hgst.com
Wed Feb 18 17:06:49 EST 2015


I am using CMake 2.8.12 on Windows. My directory/path name contains an exclamation point (e.g. C:\!Code\CommandLineTooLong). I get a 'The command line is too long.' error when linking an executable from 100 objects.

After poking around in cmGlobalNinjaGenerator.cxx, this is what I think is causing the error. Due to the exclamation point in the path name, an 'identify' variable (e.g. ident350, ident351, etc.) is generated for each object when creating the EXECUTABLE_LINKER build rule. The generated build statement consists of the identify variable names (e.g. build $ident450: CXX_EXECUTABLE_LINKER $ident350 $ident351 $ident352 ... $ident449). The length of this build statement (with identify variables) is used in the calculation to determine if a response file is required. The length does not exceed the command line limit, so a response file is not used. However, when the identify variables are replaced with the path names during the build, the build statement is too long causing an error.

Is this a known error? I searched in bug tracker, but didn't find it. If it is a known bug, is there a fix for it?

Thanks...Scott
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://public.kitware.com/pipermail/cmake/attachments/20150218/78aaf46e/attachment.html>


More information about the CMake mailing list