[Cmake] repeated SUBDIR

Wheeler, Frederick W (Research) wheeler at crd.ge.com
Wed Mar 12 09:44:00 EST 2003


Currently, if a CMakeLists.txt file has repeated SUBDIR commands, like this,

SUBDIR( foo )
SUBDIR( foo )

then there are various problems, depending on the platform.  Is it
possible/reasonable to make CMake ignore repeated SUBDIR commands?  A valid
question would be, why not just remove the repeated SUBDIR from the
CMakeLists.txt file?  Here is a situation in which that would be tricky.
Below is part of a CMakeLists.txt file for a build tree shared by several
projects.  It is convenient to have some builds set
BUILD_GEIS_PEOPLE_TRACKER and others set BUILD_GEP_TRACKTEST.  However,
those projects have some common SUBDIRs.  If a build sets both
BUILD_GEIS_PEOPLE_TRACKER and BUILD_GEP_TRACKTEST, there are repeated SUBDIR
commands.

Now, this could be worked out with additional variables and logic
controlling which dirs are included, but that would make this CMakeLists.txt
file much more complicated.

OPTION( BUILD_GEIS_PEOPLE_TRACKER "Build the GEIS People Tracker?" NO )
IF( BUILD_GEIS_PEOPLE_TRACKER )
  SUBDIRS( geipl )
  SUBDIRS( gewul )
  SUBDIRS( geis_people_tracker )
ENDIF( BUILD_GEIS_PEOPLE_TRACKER )    

OPTION( BUILD_GEP_TRACKTEST "Build the Tracker Testbed project?" NO )
IF( BUILD_GEP_TRACKTEST )
  SUBDIRS( geipl )
  SUBDIRS( gewul )
  SUBDIRS( tracker_testbed )
ENDIF( BUILD_GEP_TRACKTEST )

Regards,
Fred Wheeler



More information about the CMake mailing list