--- /dev/null
+#===========================================================================
+# 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_DIR}/BBTKConfigurePackage.cmake)
+#===========================================================================
+
+++ /dev/null
-#===========================================================================
-# SETTINGS FOR A BBTK PACKAGE
-#===========================================================================
-
-
-#===========================================================================
-# THE NAME OF THE BBTK PACKAGE = NAME OF THE CURRENT DIRECTORY
-# GET_FILENAME_COMPONENT(BBTK_PACKAGE_NAME ${CMAKE_CURRENT_SOURCE_DIR} NAME)
-SET(BBTK_PACKAGE_NAME wx)
-#===========================================================================
-
-#===========================================================================
-# UNCOMMENT NEXT LINE IF IT IS A STANDALONE PROJECT,
-# I.E. WHICH IS NOT INCLUDED INTO A WIDER PROJECT WHICH RECURSED INTO THIS
-# DIRECTORY BY SUBDIRS.
-# ELSE PUT A "SUBDIRS(this_directory)" COMMAND INTO ../CMakeLists.txt
-# PROJECT(${BBTK_PACKAGE_NAME})
-#===========================================================================
-
-
-#===========================================================================
-# SET(BBTK_PACKAGE_USE_VTK ON)
-# SET(BBTK_PACKAGE_USE_ITK ON)
-# SET(BBTK_PACKAGE_USE_GDCM ON)
-# SET(BBTK_PACKAGE_USE_GSMIS ON)
-SET(${BBTK_PACKAGE_NAME}_USE_WXWIDGETS ON)
-#===========================================================================
-
-#===========================================================================
-# PACKAGE AUTHOR
-# !!! NO COMMA ALLOWED !!!
-SET(BBTK_PACKAGE_AUTHOR "eduardo.davila/laurent.guigues@creatis.insa-lyon.fr")
-#===========================================================================
-
-#===========================================================================
-# PACKAGE DESCRIPTION
-SET(BBTK_PACKAGE_DESCRIPTION "Basic graphical interface elements (sliders, buttons ...) based on wxWidgets")
-#===========================================================================
-
-#===========================================================================
-# PACKAGE VERSION NUMBER
-SET(BBTK_PACKAGE_MAJOR_VERSION 1)
-SET(BBTK_PACKAGE_MINOR_VERSION 0)
-SET(BBTK_PACKAGE_BUILD_VERSION 0)
-#===========================================================================
-
-#===========================================================================
-# THE SOURCES OF THE PACKAGE
-# EITHER UNCOMMENT NEXT LINE TO COMPILE ALL .cxx OF THE src DIRECTORY :
-SET(BBTK_PACKAGE_COMPILE_ALL_CXX ON)
-# ... OR LIST THE FILES TO COMPILE MANUALLY :
-#SET(PACKAGE_SOURCES
-# LIST HERE THE FILES TO COMPILE TO BUILD THE LIB
-# E.G. TO COMPILE "toto.cxx" ADD "toto" (NO EXTENSION)
-# THE PATH MUST BE RELATIVE TO THE src FOLDER
-# )
-#===========================================================================
-
-#===========================================================================
-# THE SCRIPT-DEFINED BOXES OF THE PACKAGE (bbs)
-# EITHER UNCOMMENT NEXT LINE TO INCLUDE ALL .bbs OF THE bbs/boxes DIRECTORY :
-SET(BBTK_PACKAGE_INCLUDE_ALL_BBS_BOXES ON)
-# ... OR LIST THE FILES TO INCLUDE MANUALLY :
-# SET(BBTK_PACKAGE_BBS_BOXES
-# LIST HERE THE bbs FILES TO INCLUDE
-# E.G. TO INCLUDE "boxes/bbtoto.bbs" ADD "boxes/bbtoto" (NO EXTENSION)
-# !! THE PATH MUST BE RELATIVE TO THE bbs FOLDER !!
-#)
-#===========================================================================
-
-#===========================================================================
-# THE SCRIPT-DEFINED APPLICATIONS OF THE PACKAGE (bbs)
-# EITHER UNCOMMENT NEXT LINE TO INCLUDE ALL .bbs OF THE bbs/appli DIRECTORY :
-SET(BBTK_PACKAGE_INCLUDE_ALL_BBS_APPLI ON)
-# ... OR LIST THE FILES TO INCLUDE MANUALLY :
-# SET(BBTK_PACKAGE_BBS_APPLI
-# LIST HERE THE bbs FILES TO INCLUDE
-# E.G. TO INCLUDE "appli/testToto.bbs" ADD "appli/testToto" (NO EXTENSION)
-# !! THE PATH MUST BE RELATIVE TO THE bbs FOLDER !!
-#)
-#===========================================================================
-
-#===========================================================================
-INCLUDE_DIRECTORIES(
- # LIST HERE YOUR INCLUDE DIRECTORIES
- # EXCEPT BBTK'S AND THE INCLUDE DIRS THAT WERE SET
- # BY INCLUDING A LIBRARY USE FILE
- )
-#===========================================================================
-
-
-#===========================================================================
-SET(BBTK_PACKAGE_LIBS
- # LIST HERE THE LIBS TO LINK AGAINST (EXCEPT BBTK)
- )
-#===========================================================================
-
-
-
-#===========================================================================
-# EOF
-#===========================================================================
-