[CMake] CMake being too clever?

Brad King brad.king at kitware.com
Fri Jul 22 13:11:27 EDT 2005


Chris Green wrote:
> So I have my work directory, say ~/work. In it I have a source directory 
> and a build directory linked in to where I have a little more space to 
> work, eg:
> 
> ~/work/SOURCE_DIR/
> ~/work/SOURCE_DIR/CMakeLists.txt
> ~/work/build -> /scratch/me/build
> 
> If I:
> 
> cd ~/work/build
> cmake ~/work/SOURCE_DIR
> 
> The cmake proceeds just fine. However, when I try to make, I get:
> 
> CMake Error: The source directory "/scratch/me/SOURCE_DIR" does not exist.
> 
> The culprit appears to be in ~/work/build/Makefile:
> 
> # The top-level source directory on which CMake was run.
> CMAKE_SOURCE_DIR = ../SOURCE_DIR
> 
> This does not produce the desired result. Anyone care to comment?

This "feature" is because so many people asked why CMake doesn't use 
relative paths.  The CMake 2.2 makefile generator attempts to use 
relative paths wherever possible.  It has some fancy code to convert to 
a sensible relative path even in the case of symlinks and nfs mounts. 
Native build tools such as make do not have this logic.  We're 
discussing this internally and will probably end up going back to full 
paths with this example as ammunition on the FAQ for why we use them.

-Brad


More information about the CMake mailing list