[CMake] behavior of SUBDIRS changed

Ken Martin ken.martin at kitware.com
Fri Jun 10 13:17:13 EDT 2005


> That is exactly what the problem was. I was doing (I have not run this):
> 
> Parent CMakeLists.txt file
> -------------------------------
> 
> SUBDIRS(dir1 dir2)
> 
> ADD_LIBRARY(mylib "${DIR1_SRC_FILES} ${DIR2_SRC_FILES}")
> 
> Dir1 file
> -----------------------------------
> SET(DIR1_SRC_FILES "dir1.cpp" CACHE STRING "test")
> 
> 
> This does not look as illogical as your example;  in this case it
> seemed to made sense. I am in the progress of now moving to the
> ADD_SUBDIRECTORY method, but with this I need to reorder my settings so
> that the children have the right options (ie. include directories
> etc.), and I am loosing backwards compatibility (not a big issues when
> the release comes out). It appears I was quite dependent on the
> multiple passes of the way things were previously implemented.

Yup, we had quite a few projects here (or in the past) that relied on the
multiple configure trick to work (and in general that should still work).
Configure once to get it into the cache, configure the second time to use
the values. Since all the CMake GUIs tend to require at least two configures
it typically works. Thanks for converting to the new syntax, it makes a
little more sense and it can work even on the first configure.

Ken





More information about the CMake mailing list