SUBDIRLIST(APPDIRS ${CMAKE_CURRENT_SOURCE_DIR}) message("APPDIRS=${APPDIRS}") IF(BUILD_EXAMPLES) ADD_SUBDIRECTORY(samples) ENDIF(BUILD_EXAMPLES) IF(BUILD_APPS) FOREACH(app ${APPDIRS}) IF(NOT ${app} STREQUAL "samples") ADD_SUBDIRECTORY(${app}) ENDIF() ENDFOREACH() ENDIF(BUILD_APPS)