[CMake] Maximum path length in CMakeFiles

Brad King brad.king at kitware.com
Wed Aug 6 09:01:41 EDT 2008


Frans.Fuerst at elektrobit.com wrote:
> might there be a maximum path length limitation in CMake (or perhaps in
> nmake)? Trying to compile a library I have to comment out every source
> file that leads to a CMakeFiles/... object file with a total path length
> of over 200.
>  
> Is that a known problem and can I avoid it despite by shorten the path
> names?

It's not a CMake limitation, its a Windows limitation.  We have run into
many problems with path lengths in the past.  However, CMake is now
supposed to recognize when the path to an object file is too long and
replace it with a shorter name by computing a hash (md5) of the original
directory name.  The limit is 250 characters.

See cmLocalGenerator.cxx:

http://www.cmake.org/cgi-bin/viewcvs.cgi/Source/cmLocalGenerator.cxx?revision=1.280&root=CMake&view=markup

and look for the function "cmLocalGeneratorCheckObjectName".

Perhaps your file system has a lower limit?  Is this on any special kind
of disk?  Do you actually see any paths over 250 chars?

-Brad

> circumstances:
>  
> * CMake 2.6.1
> * Windows XP
> * compiling on Windows command line
> * building for nmake
>  
> error message:
>  
> Assembler messages:
> FATAL: can't create CMakeFiles\\...\    [long path]  \...\\File.cpp.o:
> No such file or directory
> C:\\   [long path]   \\File.cpp:524: fatal error: error writing to -:
>  Invalid argument
> compilation terminated.
> NMAKE : fatal error U1077: 'C:\PROGRA~1\CSLARM~1\bin\AR014C~1.EXE' :
> return code '0x1'
> Stop.
> NMAKE : fatal error U1077: '"C:\Program Files\Microsoft Visual Studio
> 8\VC\BIN\nmake.exe"' : return code '0x2'
> Stop.
> NMAKE : fatal error U1077: '"C:\Program Files\Microsoft Visual Studio
> 8\VC\BIN\nmake.exe"' : return code '0x2'
> Stop.
> 
> ----------------------------------------------------------------
> Please note: This e-mail may contain confidential information
> intended solely for the addressee. If you have received this
> e-mail in error, please do not disclose it to anyone, notify
> the sender promptly, and delete the message from your system.
> Thank you.
> 
> 
> ------------------------------------------------------------------------
> 
> _______________________________________________
> CMake mailing list
> CMake at cmake.org
> http://www.cmake.org/mailman/listinfo/cmake



More information about the CMake mailing list