-# Find gengetopt
-FIND_PATH(CLITK_GENGETOPT gengetopt)
-IF (CLITK_GENGETOPT STREQUAL "CLITK_GENGETOPT-NOTFOUND")
- MESSAGE("gengetopt not found, please install it (see http://www.gnu.org/software/gengetopt/gengetopt.html)")
-ENDIF (CLITK_GENGETOPT STREQUAL "CLITK_GENGETOPT-NOTFOUND")
-#=========================================================
-
-#=========================================================
-# Building in the source tree is forbidden
-IF(PROJECT_BINARY_DIR STREQUAL ${PROJECT_SOURCE_DIR})
- MESSAGE(FATAL_ERROR "Building in the source tree is not allowed ! Quit; remove the file 'CMakeCache.txt' and the folder 'CMakeFiles' an
-d build outside the sources (for example 'mkdir build ; cmake <CLITK_DIR>'.")
-ENDIF(PROJECT_BINARY_DIR STREQUAL ${PROJECT_SOURCE_DIR})
-#=========================================================
-
+include(${CLITK_SOURCE_DIR}/cmake/common.cmake)
+include(${CLITK_SOURCE_DIR}/cmake/dependencies.cmake)
+include(${CLITK_SOURCE_DIR}/cmake/build_opt.cmake)