[CMake] Maximum path length in CMakeFiles

Brad King brad.king at kitware.com
Thu Aug 7 09:56:07 EDT 2008


Brad King wrote:
> Frans.Fuerst at elektrobit.com wrote:
>> Important: Compiling a file in the same directory as jjjjjjjjjjjjjjjjjjjjj.cpp but with a three characters longer filename will compile fine.
> 
> That's probably because it pushes it over CMake's 250 character limit
> which switches to the md5-hashed directory name and produces a *much*
> shorter but totally unreadable object file path name.
> 
>> And here the proof of concept: renaming "CMake_Environment" to "CMake_Environm" (three characters shorter) will work fine for every file EXECPT the one that compiled before. obviously the critical part is the object file name length and it must not be near 250.
> 
> Perhaps the limit of 250 is slightly too high, and you just happen to
> have a few files that squeezed in between the true limit (247?) and 250.

I just tried an example test case on Windows with the nmake generator.
I produced a source file and build tree that causes the object file full
path to be exactly 250 characters, and (my) vs8 nmake works okay.  Then
in increment the file name length by one character, and CMake shrinks
the object name back using the hash thing I described.

So the example test case I just described crashes your nmake?

-Brad



More information about the CMake mailing list