1 #---------------------------------------------------------------------------
2 # If not a core package must include necessary cmake scripts
3 IF(NOT BBTK_CORE_PACKAGE)
5 INCLUDE(${BBTK_CMAKE_DIR}/BBTKBuildAllOption.cmake)
6 INCLUDE(${BBTK_CMAKE_DIR}/BBTKMacros.cmake)
7 INCLUDE(${BBTK_CMAKE_DIR}/BBTKFindLibraries.cmake)
8 #-------------------------------------------------------------------------
9 # Configure bbtk_config_build.xml.in for bbi to find the bbs
10 INCLUDE(${BBTK_CMAKE_DIR}/BBTKConfigureBbtkConfigXmlForBuildTree.cmake)
11 #-------------------------------------------------------------------------
13 ENDIF(NOT BBTK_CORE_PACKAGE)
14 #---------------------------------------------------------------------------
17 #-----------------------------------------------------------------------------
18 SET(${BBTK_PACKAGE_NAME}_SOURCE_DIR ${CMAKE_CURRENT_SOURCE_DIR})
19 #-----------------------------------------------------------------------------
21 #-----------------------------------------------------------------------------
22 # DOES THE USER WANT TO BUILD THE PACKAGE ?
23 OPTION(BUILD_BBTK_PACKAGE_${BBTK_PACKAGE_NAME}
24 "Build the bbtk package ${BBTK_PACKAGE_NAME} ?" OFF)
25 SWITCH_ON_IF_BUILD_ALL(BUILD_BBTK_PACKAGE_${BBTK_PACKAGE_NAME})
26 #-----------------------------------------------------------------------------
28 #-----------------------------------------------------------------------------
29 # Package dependencies
30 SET(${BBTK_PACKAGE_NAME}_DEPS bb${BBTK_PACKAGE_NAME})
31 STRING(REGEX MATCH "${${BBTK_PACKAGE_NAME}_DEPS}"
32 ${BBTK_PACKAGE_NAME}_IN_DEPS
33 "${BBTK_PACKAGES_DEPS}")
35 #-----------------------------------------------------------------------------
36 #SET(BBTK_PACKAGES_DEPS "" CACHE INTERNAL "bbtk packages dependencies" FORCE)
38 #-----------------------------------------------------------------------------
39 # IF THE USER HAS CHOSEN TO BUILD THE PACKAGE
40 IF(BUILD_BBTK_PACKAGE_${BBTK_PACKAGE_NAME})
41 #---------------------------------------------------------------------------
43 #---------------------------------------------------------------------------
44 # If package deps not in global deps : add them
45 IF(NOT ${BBTK_PACKAGE_NAME}_IN_DEPS)
46 SET(BBTK_PACKAGES_DEPS "${${BBTK_PACKAGE_NAME}_DEPS};${BBTK_PACKAGES_DEPS}"
47 CACHE INTERNAL "bbtk packages dependencies" FORCE)
48 MESSAGE(STATUS "deps=${BBTK_PACKAGES_DEPS}")
49 ENDIF(NOT ${BBTK_PACKAGE_NAME}_IN_DEPS)
50 #---------------------------------------------------------------------------
52 #---------------------------------------------------------------------------
53 # Package dependencies
54 IF(${BBTK_PACKAGE_NAME}_USE_VTK)
55 SET(USE_VTK ON CACHE BOOL "Use VTK" FORCE)
56 SET(${BBTK_PACKAGE_NAME}_LIBS
57 ${${BBTK_PACKAGE_NAME}_LIBS}
60 ENDIF(${BBTK_PACKAGE_NAME}_USE_VTK)
62 IF(${BBTK_PACKAGE_NAME}_USE_ITK)
63 SET(USE_ITK ON CACHE BOOL "Use ITK" FORCE)
64 SET(${BBTK_PACKAGE_NAME}_LIBS
65 ${${BBTK_PACKAGE_NAME}_LIBS}
68 ENDIF(${BBTK_PACKAGE_NAME}_USE_ITK)
70 IF(${BBTK_PACKAGE_NAME}_USE_GDCM)
71 SET(USE_GDCM ON CACHE BOOL "Use GDCM" FORCE)
72 SET(${BBTK_PACKAGE_NAME}_LIBS
73 ${${BBTK_PACKAGE_NAME}_LIBS}
74 ${BBTK_GDCM_LIBRARIES}
76 ENDIF(${BBTK_PACKAGE_NAME}_USE_GDCM)
78 IF(${BBTK_PACKAGE_NAME}_USE_GSMIS)
79 SET(USE_GSMIS ON CACHE BOOL "Use GSMIS" FORCE)
80 SET(${BBTK_PACKAGE_NAME}_LIBS
81 ${${BBTK_PACKAGE_NAME}_LIBS}
82 ${BBTK_GSMIS_LIBRARIES}
84 ENDIF(${BBTK_PACKAGE_NAME}_USE_GSMIS)
86 IF(${BBTK_PACKAGE_NAME}_USE_WXWIDGETS)
88 SET(BBTK_USE_WXWIDGETS ON CACHE BOOL "Use wxWidgets" FORCE)
89 MESSAGE(STATUS "BBTK_USE_WXWIDGETS forced to ON by the compilation of the package ${BBTK_PACKAGE_NAME}")
90 # bbtk already links against wx ...
91 # SET(${BBTK_PACKAGE_NAME}_LIBS
92 # ${${BBTK_PACKAGE_NAME}_LIBS}
93 # ${BBTK_WXWIDGETS_LIBRARIES}
95 ELSE(BBTK_CORE_PACKAGE)
96 # If linking against a non-wx bbtk : problem
97 IF(NOT BBTK_USE_WXWIDGETS)
98 MESSAGE(FATAL_ERROR "The bbtk package ${BBTK_PACKAGE_NAME} needs wxWidgets however the bbtk library which was found on your system was not compiled with wxWidgets : recompile it and rebuild the package.")
99 ELSE(NOT BBTK_USE_WXWIDGETS)
100 SET(USE_WXWIDGETS ON CACHE BOOL "Use wxWidgets" FORCE)
101 ENDIF(NOT BBTK_USE_WXWIDGETS)
102 ENDIF(BBTK_CORE_PACKAGE)
103 ENDIF(${BBTK_PACKAGE_NAME}_USE_WXWIDGETS)
106 #---------------------------------------------------------------------------
110 #---------------------------------------------------------------------------
111 # Recurse into subdirs
115 #---------------------------------------------------------------------------
117 #---------------------------------------------------------------------------
118 ELSE(BUILD_BBTK_PACKAGE_${BBTK_PACKAGE_NAME})
119 #-------------------------------------------------------------------------
121 #-----------------------------------------------------------------------
122 # If package deps in global deps : remove them
123 IF(${BBTK_PACKAGE_NAME}_IN_DEPS)
124 STRING(REPLACE "${${BBTK_PACKAGE_NAME}_DEPS};"
126 ${BBTK_PACKAGES_DEPS})
128 SET(BBTK_PACKAGES_DEPS ${TEMP}
129 CACHE INTERNAL "bbtk packages dependencies" FORCE)
130 ENDIF(${BBTK_PACKAGE_NAME}_IN_DEPS)
131 #-----------------------------------------------------------------------
133 #-----------------------------------------------------------------------
134 # Remove the package include scripts to avoid loading it by include *
135 FILE(REMOVE ${BBTK_BBS_BUILD_PATH}/${BBTK_PACKAGE_NAME}.bbs)
136 FILE(REMOVE ${BBTK_BBS_BUILD_PATH}/${BBTK_PACKAGE_NAME}-appli.bbs)
137 #-----------------------------------------------------------------------
140 #---------------------------------------------------------------------------
141 ENDIF(BUILD_BBTK_PACKAGE_${BBTK_PACKAGE_NAME})
142 #-----------------------------------------------------------------------------
144 #-----------------------------------------------------------------------------