[CMake] 2.6.4 add_subdirectory with same argument broken?

Carsten Neumann carsten_neumann at gmx.net
Tue May 5 17:06:32 EDT 2009


	Hello,

with cmake 2.6.4 I run into a problem with our build system (OpenSG, 
opensg.vrsource.org). It has to build a bunch of (shared) libraries from 
a fairly deeply neested source tree with dependencies between some of 
the libs, plus tests programs, unittests and documentation.
It does so by performing multiple passes over the source tree 
(collecting dependency information, building libs, building tests, ...). 
The top level CMakeLists.txt has this to drive the passes:

SET(OSG_CMAKE_PASSES "OSGCOLLECT" "OSGSETUP")
SET(OSG_PASSDIR_OSGCOLLECT "")
SET(OSG_PASSDIR_OSGSETUP   "")

# find CMakeLists.Lib.*.txt files
FILE(GLOB_RECURSE OSG_LIBRARY_CONFIG_FILES RELATIVE "${CMAKE_SOURCE_DIR}"
      "Source/*CMakeLists.Lib.*.txt")

# run build passes
FOREACH(PASS ${OSG_CMAKE_PASSES})

     SET(OSG_CMAKE_PASS ${PASS})

     MESSAGE(STATUS "\nPASS : ${OSG_CMAKE_PASS} in 
${OSG_PASSDIR_${PASS}}\n")

     FOREACH(LIBCONFIGFILE ${OSG_LIBRARY_CONFIG_FILES})
         GET_FILENAME_COMPONENT(LIBCONFIGDIR ${LIBCONFIGFILE} PATH)

	MESSAGE("ADD_SUBDIRECTORY(${LIBCONFIGDIR} ${OSG_PASSDIR_${PASS}})")
         ADD_SUBDIRECTORY(${LIBCONFIGDIR} ${OSG_PASSDIR_${PASS}})
     ENDFOREACH(LIBCONFIGFILE)
ENDFOREACH()

This all works fine with cmake 2.6.x (x < 4), but the latest version 
complains in the OSGSETUP pass on the first call to ADD_SUBDIRECTORY in 
that pass (see attachment for more details):

CMake Error at CMakeLists.txt:705 (ADD_SUBDIRECTORY):
   The binary directory
 
/store/home/carsten/devel/opensg2/svn/trunk/build.cmake.2.6.4/Source/Base

   is already used to build another source directory, so it cannot be 
used to
   build source directory

     /store/home/carsten/devel/opensg2/svn/trunk/Source/Base

   Specify a unique binary directory name.

While it is true that the binary directory is already used, it is in 
fact used to build the *same* source directory ;)
Is this intended behavior, should I file a bug report, any ideas how to 
make this or something similar work again?

	Many thanks and kind regards,
		Carsten

-------------- next part --------------
An embedded and charset-unspecified text was scrubbed...
Name: cmake-2.6.4.error.txt
URL: <http://www.cmake.org/pipermail/cmake/attachments/20090505/ec924436/attachment.txt>


More information about the CMake mailing list