[CMake] changing CMAKE_FILES_DIRECTORY

Alexander Neundorf a.neundorf-work at gmx.net
Tue Jul 27 16:29:23 EDT 2010


On Tuesday 27 July 2010, naryniecki wrote:
> hi,
> I have problem with changing this variable.
> I have directory structure as follow:
> root_dir
>  sources
>  build
>  conf1
>  conf2
> I have CMakeLists.txt placed in root_dir. I need to build my project in 2
> configuration (conf1 and conf2) and want all cmake-files where generated to
> conf1 or conf2. I want to be able to run cmake from
> root_dir. CMAKE_FILES_DIRECTORY is set as directory in which I run cmake,
> so I have CMakeFiles generated in root_dir. When I
> put set(CMAKE_FILES_DIRECTORY /build/conf1/${CMAKE_FILES_DIRECTORY}) on the
> begging of CMakeLists.txt I got to 2 CMakeFiles directory: one in root_dir
> and one in root_dir/build/conf1 and cmake fails while TRY_COMPILE. this is
> because he look for some temporary file in root_dir/build/conf1 and they
> are in root_dir. How can I change it?

This is a read-only variable, you can't change it.
In the root-dir there is the file CMakeCache.txt, which is valid only for one 
specific buildtype. You can't have two buildtype with one common 
CMakeCache.txt
You need separate build directories for that.

Alex


More information about the CMake mailing list