[CMake] Setting variables in CMakeLists.txt

Eric Noulard eric.noulard at gmail.com
Sat May 2 07:26:54 EDT 2009


2009/5/2 barcaroller <barcaroller at sympatico.ca>:
>
> "Philip Lowman" <philip at yhbt.com> wrote in message
> news:f168bb790904301926p217e9bafn6f58a1a2a9b12704 at mail.gmail.com...
>>
>> Which version of CMake are you using?
>>
>
> I was using cmake 2.6.3.  I have installed cmake 2.6.4 but the problem is
> still there.  Looking at the makefiles in the generated build/CMakeFiles
> confirms that only absolute pathnames are being generated.
>
> However, when I use in-source builds (i.e. when I build inside the 'src'
> directory instead of the 'build' directory), all of this work perfectly as
> long as I use CACHE BOOL ""
>
>    SET(CMAKE_VERBOSE_MAKEFILE    ON CACHE BOOL "")
>    SET(CMAKE_USE_RELATIVE_PATHS  ON CACHE BOOL "")
>
> In other words, relative and absolute paths are generated properly based on
> the CMAKE_USE_RELATIVE_PATHS variable (with CACHE BOOL "")
>
>    > cd src     (instead of 'cd build')
>    > cmake .    (instead of 'cmake ../src')
>    > make       (generated relative pathnames; see below)
>
>    /usr/bin/c++    -I. -I.. -I../.. -I/usr2/include/boost   -g -Wall -ansi
> -o CMakeFiles/myprogram.dir/myprogram.cpp.o  -c myprogram.cpp
>
>
> So, to recap:
>
>   If I use in-source builds, with CACHE BOOL "", it works
>   If I use out-of-source builds, it does not work (with or without CACHE
> BOOL "")

Did you check that your source tree has been properly clean from
any files after your [may be first] in-source try?

You should delete,
   CMakeCache.txt
any CMakeFiles/ directories
and any other possibly generated file.

May be you can try to build a small example project which exhibits
the issue and mail it on the list, thus other may try to reproduce the issue?

-- 
Erk


More information about the CMake mailing list