+#-----------------------------------------------------------------------------
+# DOES THE USER WANT TO BUILD THE PACKAGE ?
+OPTION(BUILD_BBTK_PACKAGE_${BBTK_PACKAGE_NAME}
+ "Build the bbtk package ${BBTK_PACKAGE_NAME} ?" OFF)
+#-----------------------------------------------------------------------------
-#EED 12/05/2008
-## BOOST
+#-----------------------------------------------------------------------------
+IF(BBTK_CORE_PACKAGE)
+ IF(NOT ${BBTK_PACKAGE_NAME}_EXCLUDE_FROM_BUILD_ALL)
+ SWITCH_ON_IF_BUILD_ALL(BUILD_BBTK_PACKAGE_${BBTK_PACKAGE_NAME})
+ ENDIF(NOT ${BBTK_PACKAGE_NAME}_EXCLUDE_FROM_BUILD_ALL)
+ENDIF(BBTK_CORE_PACKAGE)
+#-----------------------------------------------------------------------------
-### EED E:\Creatis\bbtk\kernel\src\CMakeLists.txt
-## -----------------------------------------------------------------------------
-## BOOST
-#SET(BBTK_USE_BOOST TRUE)
-#IF(BBTK_USE_BOOST)
-# SET(USE_BOOST ON CACHE BOOL "Use boost C++ library" FORCE)
-# SET(BBTK_LINK_LIBRARIES
-# ${BBTK_LINK_LIBRARIES}
-# ${BBTK_BOOST_LIBRARIES}
-# )
-#ENDIF(BBTK_USE_BOOST)
-## -----------------------------------------------------------------------------
-
-## EED E:\Creatis\bbtk\kernel\cmake\BBTKDefineOptions.cmake
-## -----------------------------------------------------------------------------
-## BOOST C++
-#SET(BBTK_SHIPPED_BOOST boost_1_35_0 CACHE INTERNAL "Shipped boost dir" FORCE)
-#OPTION(BBTK_USE_SHIPPED_BOOST
-# "Use the shipped boost C++ library (${BBTK_SHIPPED_BOOST})" ON)
-## -----------------------------------------------------------------------------
-
-
-## EED E:\Creatis\bbtk\kernel\cmake\BBTKDefineOptions.cmake
-# INCLUDE_DIRECTORIES( ${BBTK_DIR}/include/bbtk/ThirdParty/${BBTK_SHIPPED_BOOST}/)
-#message ("EED Maracas/bbtk/maracasvusu/Configure.cmake " ${BBTK_DIR}/include/bbtk/ThirdParty/${BBTK_SHIPPED_BOOST}/)
-
-
-
-#===========================================================================
-# If the package is not a "core" bbtk package (included into the toolkit)
-# then we have to find (and use) bbtk
-IF(NOT BBTK_CORE_PACKAGE)
+#-----------------------------------------------------------------------------
+# IF THE USER HAS CHOSEN TO BUILD THE PACKAGE
+IF(BUILD_BBTK_PACKAGE_${BBTK_PACKAGE_NAME})
+ #---------------------------------------------------------------------------
+
+ #===========================================================================
+ # If the package is not a "core" bbtk package (included into the toolkit)
+ # then we have to find (and use) bbtk
+ IF(NOT BBTK_CORE_PACKAGE)
+ #-------------------------------------------------------------------------
+ # Find and use the Black Box Toolkit
+ # Search BBTK
+ FIND_PACKAGE(BBTK)
+ # If bbtk found
+ IF(BBTK_FOUND)
+ INCLUDE(${BBTK_USE_FILE})
+ SET(BBTK_PACKAGE_LIBS
+ ${BBTK_PACKAGE_LIBS}
+ ${BBTK_LIBRARIES})
+ MARK_AS_ADVANCED(BBTK_DIR)
+ ENDIF(BBTK_FOUND)
+ ENDIF(NOT BBTK_CORE_PACKAGE)
+
+ #===========================================================================
+ # Include package configuration cmake script from bbtk dir
+ INCLUDE(${BBTK_CMAKE_DIR}/BBTKConfigurePackage.cmake)
+ #===========================================================================
+
+
+ #---------------------------------------------------------------------------
+ELSE(BUILD_BBTK_PACKAGE_${BBTK_PACKAGE_NAME})
#-------------------------------------------------------------------------
- # Find and use the Black Box Toolkit
- # Search BBTK
- FIND_PACKAGE(BBTK)
- # If bbtk found
- IF(BBTK_FOUND)
- INCLUDE(${BBTK_USE_FILE})
- SET(BBTK_PACKAGE_LIBS
- ${BBTK_PACKAGE_LIBS}
- ${BBTK_LIBRARIES})
- MARK_AS_ADVANCED(BBTK_DIR)
- ENDIF(BBTK_FOUND)
+
+ #-----------------------------------------------------------------------
+ IF(BBTK_CORE_PACKAGE)
+ #-----------------------------------------------------------------------
+ # If package deps in global deps : reset global deps
+ IF(${BBTK_PACKAGE_NAME}_IN_DEPS)
+ SET(BBTK_PACKAGES_DEPS "" CACHE INTERNAL
+ "bbtk packages dependencies" FORCE)
+ # STRING(REPLACE "${${BBTK_PACKAGE_NAME}_DEPS};"
+ # "" TEMP
+ # ${BBTK_PACKAGES_DEPS})
+ #
+ # SET(BBTK_PACKAGES_DEPS ${TEMP}
+ # CACHE INTERNAL "bbtk packages dependencies" FORCE)
+ ENDIF(${BBTK_PACKAGE_NAME}_IN_DEPS)
+ #-----------------------------------------------------------------------
+
+ #-----------------------------------------------------------------------
+ # Remove the package include scripts to avoid loading it by include *
+ FILE(REMOVE ${BBTK_BBS_BUILD_PATH}/${BBTK_PACKAGE_NAME}.bbs)
+ FILE(REMOVE ${BBTK_BBS_BUILD_PATH}/${BBTK_PACKAGE_NAME}-appli.bbs)
+ #-----------------------------------------------------------------------
+ ENDIF(BBTK_CORE_PACKAGE)
+
#-------------------------------------------------------------------------
-ENDIF(NOT BBTK_CORE_PACKAGE)
-#===========================================================================
-
-#===========================================================================
-# Include package configuration cmake script from bbtk dir
-INCLUDE(${BBTK_CMAKE_DIR}/BBTKConfigurePackage.cmake)
-#===========================================================================
-
+ENDIF(BUILD_BBTK_PACKAGE_${BBTK_PACKAGE_NAME})