[CMake] CMAKE_USE_RELATIVE_PATHS

Bill Hoffman bill.hoffman at kitware.com
Sat Nov 21 12:47:28 EST 2009


barcaroller wrote:
> This is a follow up to the message ("Setting variables in CMakeLists.txt") 
> that I posted on April 30th, 2009.
> 
> I am now using cmake 2.8.0 and the CMAKE_USE_RELATIVE_PATHS variable still 
> does not work.  It does work for in-source builds (when I build the object 
> files inside the 'src' directory) but it does not work for out-of-source 
> builds.
> 
> The cmake documentation does specify that CMAKE_USE_RELATIVE_PATHS may not 
> work in complex projects but my project could not be simpler (see below).
> 
>   project
>      |
>      +--- src     <- contains CMakeLists.txt
>      |
>      +--- build   <- cmake ../src ; make
> 
> 
> All directories reside on a local disk.  When I build from the build 
> directory, the gcc compiler uses absolute pathnames no matter what value the 
> CMAKE_USE_RELATIVE_PATHS  variable is set at.  This means that the __FILE__ 
> macro uses absolute pathnames, which totally screws up the log files.
> 
> Will this ever be fixed or should I give up on out-of-source builds?
> 
> 

You should give up on CMAKE_USE_RELATIVE_PATHS , and we should deprecate 
it from CMake.  It just does not work, and frustrates people.

-Bill


More information about the CMake mailing list