CMakeLists.txt 18 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512
  1. ###########################################################################
  2. #
  3. # Library: CTK
  4. #
  5. # Copyright (c) 2010 Kitware Inc.
  6. #
  7. # Licensed under the Apache License, Version 2.0 (the "License");
  8. # you may not use this file except in compliance with the License.
  9. # You may obtain a copy of the License at
  10. #
  11. # http://www.commontk.org/LICENSE
  12. #
  13. # Unless required by applicable law or agreed to in writing, software
  14. # distributed under the License is distributed on an "AS IS" BASIS,
  15. # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
  16. # See the License for the specific language governing permissions and
  17. # limitations under the License.
  18. #
  19. ###########################################################################
  20. CMAKE_MINIMUM_REQUIRED(VERSION 2.8)
  21. #-----------------------------------------------------------------------------
  22. # See http://cmake.org/cmake/help/cmake-2-8-docs.html#section_Policies for details
  23. #
  24. SET(project_policies
  25. CMP0001 # NEW: CMAKE_BACKWARDS_COMPATIBILITY should no longer be used.
  26. CMP0002 # NEW: Logical target names must be globally unique.
  27. CMP0003 # NEW: Libraries linked via full path no longer produce linker search paths.
  28. CMP0004 # NEW: Libraries linked may NOT have leading or trailing whitespace.
  29. CMP0005 # NEW: Preprocessor definition values are now escaped automatically.
  30. CMP0006 # NEW: Installing MACOSX_BUNDLE targets requires a BUNDLE DESTINATION.
  31. CMP0007 # NEW: List command no longer ignores empty elements.
  32. CMP0008 # NEW: Libraries linked by full-path must have a valid library file name.
  33. CMP0009 # NEW: FILE GLOB_RECURSE calls should not follow symlinks by default.
  34. CMP0010 # NEW: Bad variable reference syntax is an error.
  35. CMP0011 # NEW: Included scripts do automatic cmake_policy PUSH and POP.
  36. CMP0012 # NEW: if() recognizes numbers and boolean constants.
  37. CMP0013 # NEW: Duplicate binary directories are not allowed.
  38. CMP0014 # NEW: Input directories must have CMakeLists.txt
  39. )
  40. FOREACH(policy ${project_policies})
  41. IF(POLICY ${policy})
  42. CMAKE_POLICY(SET ${policy} NEW)
  43. ENDIF()
  44. ENDFOREACH()
  45. #-----------------------------------------------------------------------------
  46. PROJECT(CTK)
  47. #-----------------------------------------------------------------------------
  48. #-----------------------------------------------------------------------------
  49. # Default to shared library
  50. SET(CTK_LIBRARY_MODE "SHARED")
  51. SET(CTK_BUILD_SHARED_LIBS TRUE)
  52. #-----------------------------------------------------------------------------
  53. # Superbuild Option - Enabled by default
  54. #
  55. OPTION(CTK_SUPERBUILD "Build CTK and the projects it depends on via SuperBuild.cmake." ON)
  56. MARK_AS_ADVANCED(CTK_SUPERBUILD)
  57. #-----------------------------------------------------------------------------
  58. # Output directories.
  59. #
  60. FOREACH(type LIBRARY RUNTIME ARCHIVE)
  61. # Make sure the directory exists
  62. IF(DEFINED CTK_CMAKE_${type}_OUTPUT_DIRECTORY
  63. AND NOT EXISTS ${CTK_CMAKE_${type}_OUTPUT_DIRECTORY})
  64. MESSAGE(FATAL_ERROR "CTK_CMAKE_${type}_OUTPUT_DIRECTORY is set to a non-existing directory [${CTK_CMAKE_${type}_OUTPUT_DIRECTORY}]")
  65. ENDIF()
  66. IF(CTK_SUPERBUILD)
  67. SET(output_dir ${CTK_BINARY_DIR}/bin)
  68. IF(NOT DEFINED CTK_CMAKE_${type}_OUTPUT_DIRECTORY)
  69. SET(CTK_CMAKE_${type}_OUTPUT_DIRECTORY ${CTK_BINARY_DIR}/CTK-build/bin)
  70. ENDIF()
  71. ELSE()
  72. IF(NOT DEFINED CTK_CMAKE_${type}_OUTPUT_DIRECTORY)
  73. SET(output_dir ${CTK_BINARY_DIR}/bin)
  74. ELSE()
  75. SET(output_dir ${CTK_CMAKE_${type}_OUTPUT_DIRECTORY})
  76. ENDIF()
  77. ENDIF()
  78. SET(CMAKE_${type}_OUTPUT_DIRECTORY ${output_dir} CACHE INTERNAL "Single output directory for building all libraries.")
  79. ENDFOREACH()
  80. #-----------------------------------------------------------------------------
  81. # Install directories, used for install rules.
  82. #
  83. SET(CTK_INSTALL_BIN_DIR "bin")
  84. SET(CTK_INSTALL_LIB_DIR "lib")
  85. SET(CTK_INSTALL_INCLUDE_DIR "include")
  86. SET(CTK_INSTALL_DOC_DIR "doc")
  87. #-----------------------------------------------------------------------------
  88. # CTK version number. An even minor number corresponds to releases.
  89. #
  90. SET(CTK_MAJOR_VERSION 0)
  91. SET(CTK_MINOR_VERSION 1)
  92. SET(CTK_BUILD_VERSION 0)
  93. SET(CTK_VERSION
  94. "${CTK_MAJOR_VERSION}.${CTK_MINOR_VERSION}.${CTK_BUILD_VERSION}")
  95. # Append the library version information to the library target
  96. # properties. A parent project may set its own properties and/or may
  97. # block this.
  98. IF(NOT CTK_NO_LIBRARY_VERSION)
  99. SET(CTK_LIBRARY_PROPERTIES ${CTK_LIBRARY_PROPERTIES}
  100. VERSION "${CTK_VERSION}"
  101. SOVERSION "${CTK_MAJOR_VERSION}.${CTK_MINOR_VERSION}"
  102. )
  103. ENDIF()
  104. #-----------------------------------------------------------------------------
  105. # Update CMake module path
  106. # Note: FindXXX.cmake script specific to utility should be copied into Utilities/CMake
  107. #
  108. SET(CMAKE_MODULE_PATH
  109. "${CMAKE_CURRENT_SOURCE_DIR}/Utilities/CMake"
  110. "${CMAKE_CURRENT_SOURCE_DIR}/CMake"
  111. ${CMAKE_MODULE_PATH})
  112. #-----------------------------------------------------------------------------
  113. # Clear CTK_BASE_INCLUDE_DIRS and CTK_BASE_LIBRARIES
  114. #
  115. SET(CTK_BASE_LIBRARIES CACHE INTERNAL "CTK base libraries" FORCE)
  116. SET(CTK_BASE_INCLUDE_DIRS CACHE INTERNAL "CTK includes" FORCE)
  117. # Variable use in CTKConfig.cmake.in
  118. SET(CTK_LIBRARIES CACHE INTERNAL "CTK libraries" FORCE)
  119. #-----------------------------------------------------------------------------
  120. # CMake Function(s) and Macro(s)
  121. #
  122. INCLUDE(CMake/ctkMacroParseArguments.cmake)
  123. INCLUDE(CMake/ctkMacroListFilter.cmake)
  124. INCLUDE(CMake/ctkMacroBuildLib.cmake)
  125. INCLUDE(CMake/ctkMacroBuildPlugin.cmake)
  126. INCLUDE(CMake/ctkMacroBuildApp.cmake)
  127. INCLUDE(CMake/ctkMacroBuildQtDesignerPlugin.cmake)
  128. INCLUDE(CMake/ctkMacroSetupQt.cmake)
  129. INCLUDE(CMake/ctkMacroTargetLibraries.cmake) # Import multiple macros
  130. INCLUDE(CMake/ctkFunctionExtractOptionNameAndValue.cmake)
  131. INCLUDE(CMake/ctkFunctionExecuteProcess.cmake)
  132. INCLUDE(CMake/ctkMacroValidateBuildOptions.cmake)
  133. INCLUDE(CMake/ctkMacroAddCtkLibraryOptions.cmake)
  134. INCLUDE(CMake/ctkFunctionGenerateDGraphInput.cmake)
  135. INCLUDE(CMake/ctkFunctionGenerateProjectXml.cmake)
  136. INCLUDE(CMake/ctkMacroGeneratePluginManifest.cmake)
  137. INCLUDE(CMake/ctkMacroGeneratePluginResourceFile.cmake)
  138. # Used by CTKGenerateCTKConfig.cmake
  139. SET(CTK_CMAKE_DIR ${CTK_SOURCE_DIR}/CMake)
  140. SET(CTK_CMAKE_UTILITIES_DIR ${CTK_SOURCE_DIR}/Utilities/CMake)
  141. #-----------------------------------------------------------------------------
  142. # Testing
  143. #
  144. OPTION(BUILD_TESTING "Test the project" ON)
  145. IF(BUILD_TESTING)
  146. ENABLE_TESTING()
  147. INCLUDE(CTest)
  148. SET(CPP_TEST_PATH ${CMAKE_RUNTIME_OUTPUT_DIRECTORY})
  149. MARK_AS_ADVANCED(TCL_TCLSH DART_ROOT)
  150. # Setup file for setting custom ctest vars
  151. CONFIGURE_FILE(
  152. CMake/CTestCustom.cmake.in
  153. ${CMAKE_CURRENT_BINARY_DIR}/CTestCustom.cmake
  154. @ONLY
  155. )
  156. # Configuration for the CMake-generated test driver
  157. SET(CMAKE_TESTDRIVER_EXTRA_INCLUDES "#include <stdexcept>")
  158. SET(CMAKE_TESTDRIVER_BEFORE_TESTMAIN "
  159. try
  160. {")
  161. SET(CMAKE_TESTDRIVER_AFTER_TESTMAIN " }
  162. catch( std::exception & excp )
  163. {
  164. fprintf(stderr,\"%s\\n\",excp.what());
  165. return EXIT_FAILURE;
  166. }
  167. catch( ... )
  168. {
  169. printf(\"Exception caught in the test driver\\n\");
  170. return EXIT_FAILURE;
  171. }
  172. ")
  173. ENDIF()
  174. #-----------------------------------------------------------------------------
  175. # Coverage
  176. #
  177. OPTION(WITH_COVERAGE "Enable/Disable coverage" OFF)
  178. #-----------------------------------------------------------------------------
  179. # Documentation
  180. #
  181. OPTION(DOCUMENTATION_TARGET_IN_ALL "Include the custom target for building documentation in 'all'" OFF)
  182. MARK_AS_ADVANCED(DOCUMENTATION_TARGET_IN_ALL)
  183. OPTION(DOCUMENTATION_ARCHIVES_OUTPUT_DIRECTORY "Where documentation archives should be stored" ${CMAKE_CURRENT_BINARY_DIR})
  184. MARK_AS_ADVANCED(DOCUMENTATION_ARCHIVES_OUTPUT_DIRECTORY)
  185. #-----------------------------------------------------------------------------
  186. # Additional CXX/C Flags
  187. #
  188. SET(ADDITIONAL_C_FLAGS "" CACHE STRING "Additional C Flags")
  189. MARK_AS_ADVANCED(ADDITIONAL_C_FLAGS)
  190. SET(ADDITIONAL_CXX_FLAGS "" CACHE STRING "Additional CXX Flags")
  191. MARK_AS_ADVANCED(ADDITIONAL_CXX_FLAGS)
  192. #-----------------------------------------------------------------------------
  193. # Set symbol visibility Flags
  194. #
  195. IF(CMAKE_CXX_COMPILER_ID)
  196. # Set the default symbol visibility to hidden for gcc
  197. IF(${CMAKE_CXX_COMPILER_ID} STREQUAL "GNU")
  198. SET(VISIBILITY_CXX_FLAGS "-fvisibility=hidden -fvisibility-inlines-hidden")
  199. ENDIF()
  200. ENDIF()
  201. #-----------------------------------------------------------------------------
  202. # Set coverage Flags
  203. #
  204. IF(WITH_COVERAGE)
  205. IF(CMAKE_CXX_COMPILER_ID AND ${CMAKE_CXX_COMPILER_ID} STREQUAL "GNU")
  206. SET(coverage_flags "-g -fdiagnostics-show-option -fprofile-arcs -ftest-coverage -O3 -DNDEBUG")
  207. SET(COVERAGE_CXX_FLAGS ${coverage_flags})
  208. SET(COVERAGE_C_FLAGS ${coverage_flags})
  209. ENDIF()
  210. ENDIF()
  211. #-----------------------------------------------------------------------------
  212. # CTK C/CXX Flags
  213. #
  214. SET(CTK_C_FLAGS "${COVERAGE_C_FLAGS} ${ADDITIONAL_C_FLAGS}")
  215. SET(CTK_CXX_FLAGS "${VISIBILITY_CXX_FLAGS} ${COVERAGE_CXX_FLAGS} ${ADDITIONAL_CXX_FLAGS}")
  216. #-----------------------------------------------------------------------------
  217. # QT
  218. #
  219. ctkMacroSetupQt()
  220. # Update CTK_BASE_LIBRARIES with QT libraries
  221. IF(QT4_FOUND)
  222. SET(CTK_BASE_LIBRARIES ${CTK_BASE_LIBRARIES} ${QT_LIBRARIES} CACHE INTERNAL "CTK base libraries" FORCE)
  223. ENDIF()
  224. #-----------------------------------------------------------------------------
  225. # CTK Libraries - Use ON or OFF to indicate if the library should be built by default
  226. #
  227. SET(CTK_LIBS
  228. Core:ON
  229. PluginFramework:ON
  230. Widgets:OFF
  231. DICOM/Core:OFF
  232. DICOM/Widgets:OFF
  233. Messaging/Core:OFF
  234. Scripting/Python/Core:OFF
  235. Scripting/Python/Widgets:OFF
  236. Visualization/VTK/Core:OFF
  237. Visualization/VTK/Widgets:OFF
  238. Visualization/XIP:OFF
  239. )
  240. #-----------------------------------------------------------------------------
  241. # CTK Plugins - Use ON or OFF to indicate if the plugin should be built by default
  242. #
  243. SET(CTK_PLUGINS
  244. org.commontk.eventbus:ON
  245. org.commontk.cli:OFF
  246. )
  247. #-----------------------------------------------------------------------------
  248. # CTK Applications - Use ON or OFF to indicate if the application should be built by default
  249. #
  250. SET(CTK_APPLICATIONS
  251. ctkCLIPluginExplorer:OFF
  252. ctkPluginBrowser:OFF
  253. ctkDICOM:OFF
  254. ctkDICOMIndexer:OFF
  255. )
  256. #-----------------------------------------------------------------------------
  257. # To make options show up in both CTK-SuperBuild and CTK regular build, let's add them
  258. # before the SuperBuild script is included
  259. #
  260. # Let's mark as advanced some default properties
  261. MARK_AS_ADVANCED(CMAKE_INSTALL_PREFIX)
  262. MARK_AS_ADVANCED(DART_TESTING_TIMEOUT)
  263. # KWStyle
  264. OPTION(CTK_USE_KWSTYLE "Enable sourcecode-based style tests." OFF)
  265. #MARK_AS_ADVANCED(CTK_USE_KWSTYLE)
  266. #---------------------------------------------------------------------------
  267. # Will contain a list of sub-directory without option ON or OFF
  268. #
  269. SET(CTK_LIBS_SUBDIRS )
  270. SET(CTK_PLUGINS_SUBDIRS )
  271. SET(CTK_APPLICATIONS_SUBDIRS )
  272. #-----------------------------------------------------------------------------
  273. # Build options associated with CTK libraries
  274. # Note also that if
  275. # the file Libs/<DIR>/<LIBNAME>/ctk_library_options.cmake exists and look like:
  276. #
  277. # SET(ctk_library_options
  278. # OPT1:OFF
  279. # OPT2:ON
  280. # )
  281. #
  282. # In addition to 'CTK_LIB_<DIR>/<LIBNAME>' option, the following ones
  283. # will also be available in CMake configure menu:
  284. # CTK_LIB_<DIR>/<LIBNAME>_OPT1 (set to OFF)
  285. # CTK_LIB_<DIR>/<LIBNAME>_OPT2 (set to ON)
  286. #
  287. FOREACH(lib ${CTK_LIBS})
  288. ctkFunctionExtractOptionNameAndValue(${lib} lib_name lib_value)
  289. OPTION(CTK_LIB_${lib_name} "Enable ${lib_name} Library." ${lib_value})
  290. ctkMacroAddCtkLibraryOptions(${lib_name})
  291. LIST(APPEND CTK_LIBS_SUBDIRS "${lib_name}")
  292. ENDFOREACH()
  293. # Build options associated with CTK plugins
  294. FOREACH(plugin ${CTK_PLUGINS})
  295. ctkFunctionExtractOptionNameAndValue(${plugin} plugin_name plugin_value)
  296. OPTION(CTK_PLUGIN_${plugin_name} "Build ${plugin_name} Plugin." ${plugin_value})
  297. LIST(APPEND CTK_PLUGINS_SUBDIRS "${plugin_name}")
  298. ENDFOREACH()
  299. # Build options associated with CTK applications
  300. FOREACH(app ${CTK_APPLICATIONS})
  301. ctkFunctionExtractOptionNameAndValue(${app} app_name app_value)
  302. OPTION(CTK_APP_${app_name} "Build ${app_name} Application." ${app_value})
  303. LIST(APPEND CTK_APPLICATIONS_SUBDIRS "${app_name}")
  304. ENDFOREACH()
  305. #-----------------------------------------------------------------------------
  306. # Generate target_directories list - List of directory corresponding to the different
  307. # libraries, plugins and applications associated with the corresponding option name.
  308. #
  309. # Create list of directories corresponding to the enabled targets
  310. SET(target_directories)
  311. FOREACH(lib ${CTK_LIBS_SUBDIRS})
  312. SET(option_name CTK_LIB_${lib})
  313. LIST(APPEND target_directories "${CMAKE_CURRENT_SOURCE_DIR}/Libs/${lib}^^${option_name}")
  314. ENDFOREACH()
  315. FOREACH(plugin ${CTK_PLUGINS_SUBDIRS})
  316. SET(option_name CTK_PLUGIN_${plugin})
  317. LIST(APPEND target_directories "${CMAKE_CURRENT_SOURCE_DIR}/Plugins/${plugin}^^${option_name}")
  318. ENDFOREACH()
  319. FOREACH(app ${CTK_APPLICATIONS_SUBDIRS})
  320. SET(option_name CTK_APP_${app})
  321. LIST(APPEND target_directories "${CMAKE_CURRENT_SOURCE_DIR}/Applications/${app}^^${option_name}")
  322. ENDFOREACH()
  323. #MESSAGE(STATUS target_directories:${target_directories})
  324. #-----------------------------------------------------------------------------
  325. # Compile DGraph - An application allowing to check for cycle in DAG and also obtain the
  326. # topological order.
  327. TRY_COMPILE(RESULT_VAR ${CTK_BINARY_DIR}/Utilities/DGraph ${CTK_SOURCE_DIR}/Utilities/DGraph
  328. DGraph
  329. CMAKE_FLAGS
  330. -DQT_QMAKE_EXECUTABLE:BOOL=${QT_QMAKE_EXECUTABLE}
  331. -DCMAKE_VERBOSE_MAKEFILE:BOOL=FALSE
  332. OUTPUT_VARIABLE output)
  333. IF(NOT RESULT_VAR)
  334. MESSAGE(FATAL_ERROR "Failed to compile DGraph application.\n${output}")
  335. ENDIF()
  336. FIND_PROGRAM(DGraph_EXECUTABLE DGraph
  337. "${CTK_BINARY_DIR}/Utilities/DGraph/"
  338. "${CTK_BINARY_DIR}/Utilities/DGraph/bin/"
  339. "${CTK_BINARY_DIR}/Utilities/DGraph/Debug/"
  340. "${CTK_BINARY_DIR}/Utilities/DGraph/Release/")
  341. MARK_AS_ADVANCED(DGraph_EXECUTABLE)
  342. #-----------------------------------------------------------------------------
  343. # Let's make sure the enabled/disabled libraries, plugins or applications are coherent
  344. #
  345. ctkFunctionGenerateDGraphInput(${CTK_BINARY_DIR} "${target_directories}" FALSE)
  346. ctkMacroValidateBuildOptions("${CTK_BINARY_DIR}" "${DGraph_EXECUTABLE}" "${target_directories}")
  347. #-----------------------------------------------------------------------------
  348. # DGraph
  349. #
  350. # Generate DGraph input file expected by DGraph
  351. ctkFunctionGenerateDGraphInput(${CTK_BINARY_DIR} "${target_directories}" TRUE)
  352. # Obtain list of target ordered topologically
  353. ctkFunctionExecuteProcess(
  354. COMMAND "${DGraph_EXECUTABLE}" "${CTK_BINARY_DIR}/DGraphInput.txt"
  355. PATH_LIST \"${QT_INSTALLED_LIBRARY_DIR}\"
  356. WORKING_DIRECTORY ${CTK_BINARY_DIR}
  357. RESULT_VARIABLE RESULT_VAR
  358. OUTPUT_VARIABLE CTEST_PROJECT_SUBPROJECTS
  359. ERROR_VARIABLE error
  360. OUTPUT_STRIP_TRAILING_WHITESPACE
  361. )
  362. IF(RESULT_VAR)
  363. MESSAGE(FATAL_ERROR "Failed to obtain list of target ordered topologically.\n${RESULT_VAR}\n${CTK_BINARY_DIR}\n${error}")
  364. ENDIF()
  365. # If the list of subproject is empty, let's at least build CTKCore
  366. LIST(LENGTH CTEST_PROJECT_SUBPROJECTS subproject_count)
  367. IF (subproject_count EQUAL 0)
  368. SET(CTEST_PROJECT_SUBPROJECTS CTKCore)
  369. ENDIF()
  370. # Configure CTestConfigSubProject.cmake used that could be used by CTest scripts
  371. CONFIGURE_FILE(${CTK_SOURCE_DIR}/CTestConfigSubProject.cmake.in
  372. ${CTK_BINARY_DIR}/CTestConfigSubProject.cmake)
  373. #-----------------------------------------------------------------------------
  374. # Project.xml
  375. #
  376. # Generate Project.xml file expected by the CTest driver script
  377. ctkFunctionGenerateProjectXml(${CTK_BINARY_DIR} ${PROJECT_NAME} "${target_directories}" ${CTK_SUPERBUILD})
  378. #-----------------------------------------------------------------------------
  379. # Superbuild script
  380. #
  381. IF(CTK_SUPERBUILD)
  382. INCLUDE("${CMAKE_CURRENT_SOURCE_DIR}/SuperBuild.cmake")
  383. RETURN()
  384. ENDIF()
  385. #-----------------------------------------------------------------------------
  386. # CTK_SUPERBUILD_BINARY_DIR
  387. # If CTK_SUPERBUILD_BINARY_DIR isn't defined, it means CTK is *NOT* build using Superbuild.
  388. # In that specific case, CTK_SUPERBUILD_BINARY_DIR should default to CTK_BINARY_DIR
  389. IF(NOT DEFINED CTK_SUPERBUILD_BINARY_DIR)
  390. SET(CTK_SUPERBUILD_BINARY_DIR ${CTK_BINARY_DIR})
  391. ENDIF()
  392. #-----------------------------------------------------------------------------
  393. # Configure files with settings
  394. #
  395. CONFIGURE_FILE(${CTK_SOURCE_DIR}/UseCTK.cmake.in
  396. ${CTK_SUPERBUILD_BINARY_DIR}/UseCTK.cmake COPYONLY IMMEDIATE)
  397. #-----------------------------------------------------------------------------
  398. # Set C/CXX Flags
  399. #
  400. SET(CMAKE_CXX_FLAGS ${CTK_CXX_FLAGS})
  401. SET(CMAKE_C_FLAGS ${CTK_C_FLAGS})
  402. #-----------------------------------------------------------------------------
  403. # Add CTK library subdirectories
  404. #
  405. FOREACH(lib ${CTK_LIBS_SUBDIRS})
  406. IF (CTK_LIB_${lib})
  407. ADD_SUBDIRECTORY(Libs/${lib})
  408. ENDIF()
  409. ENDFOREACH()
  410. #-----------------------------------------------------------------------------
  411. # Add CTK plugin subdirectories
  412. #
  413. FOREACH(plugin ${CTK_PLUGINS_SUBDIRS})
  414. IF (CTK_PLUGIN_${plugin})
  415. ADD_SUBDIRECTORY(Plugins/${plugin})
  416. ENDIF()
  417. ENDFOREACH()
  418. #-----------------------------------------------------------------------------
  419. # Add CTK application subdirectories
  420. #
  421. FOREACH(app ${CTK_APPLICATIONS_SUBDIRS})
  422. IF (CTK_APP_${app})
  423. ADD_SUBDIRECTORY(Applications/${app})
  424. ENDIF()
  425. ENDFOREACH()
  426. #-----------------------------------------------------------------------------
  427. # Add general purpose subdirectories
  428. #
  429. #ADD_SUBDIRECTORY(Testing)
  430. #ADD_SUBDIRECTORY(Examples)
  431. #-----------------------------------------------------------------------------
  432. # Style Checking configuration
  433. #
  434. INCLUDE(Utilities/KWStyle/KWStyle.cmake)
  435. #---------------------------------------------------------------------------
  436. # Documentation
  437. #
  438. ADD_SUBDIRECTORY( Documentation )
  439. #-----------------------------------------------------------------------------
  440. # The commands in this directory are intended to be executed as
  441. # the end of the whole configuration process, as a "last step".
  442. # This directory is typically the last SUBDIRS in the main CMakeLists.txt.
  443. ADD_SUBDIRECTORY(Utilities/LastConfigureStep)