[CMake] non-canonical paths and generated files = error

Zachary Pincus zpincus at stanford.edu
Sat Jan 14 03:16:23 EST 2006


Hi folks,

I've run into a minor issue with CMake when a particular file:
(a) is a generated file (property explicitly set to GENERATED, or  
marked as the  output of a custom command),
(b) has a non-canonical path set (e.g. the path includes '.' or or an  
empty directory component, such as '/usr//local/./bin/'), and
(c) is depended upon by another file

If these conditions are met, CMake seems unable to recognize that the  
dependency file is to be produced during the build, and then tries  
(and fails) to find it in the filesystem.

Here is an example of the error produced:
> CMake Error: can not find file /Users/zpincus/Documents/Research/ 
> Theriot Lab/Development/ITK Wrapping/EWP-bin/ 
> wrap_BufferConversionPython.cxx
> Tried .c .C .c++ .cc .cpp .cxx .m .M .mm .h .h+ 
> + .hm .hpp .hxx .in .txx
>
> CMake Error: CMake failed to properly look up cmSourceFile: /Users/ 
> zpincus/Documents/Research/Theriot Lab/Development/ITK
> Wrapping/EWP-bin/./wrap_BufferConversionPython.cxx

When I modified the CMakeLists file so that the '.' would not be  
added to the path, the error went away. This is sort of a hackish  
thing to have to do in general when you want paths which have  
optional inner components (e.g. CMAKE_CONFIG_INTDIR or whatnot to  
optionally have multiple binary directories like 'bin/Release' and  
'bin/RelWithDebInfo' or sometimes just 'bin' if CMAKE_CONFIG_INTDIR  
is empty).

If it would help, I could try to write a test case illustrating this  
issue.

Zach Pincus


More information about the CMake mailing list