+#
+# Test CMake version
+#
+CMAKE_MINIMUM_REQUIRED(VERSION 2.4)
+#MARK_AS_ADVANCED( FORCE CMAKE_BACKWARDS_COMPATIBILITY )
+
+# for CMake 2.6 corrected behaviour (see "cmake --help-policy CMP0003")
+IF(COMMAND cmake_policy AND ${CMAKE_MAJOR_VERSION} EQUAL 2 AND ${CMAKE_MINOR_VERSION} GREATER 4)
+ CMAKE_POLICY(SET CMP0003 NEW)
+ CMAKE_POLICY(SET CMP0005 NEW)
+ENDIF(COMMAND cmake_policy AND ${CMAKE_MAJOR_VERSION} EQUAL 2 AND ${CMAKE_MINOR_VERSION} GREATER 4)
+
PROJECT(PROJECT_NAME)
SET(PROJECT_MAJOR_VERSION 1)
#-----------------------------------------------------------------------------
+#-----------------------------------------------------------------------------
+IF(USE_GDCM2)
+ # Search GDCM2
+ FIND_PACKAGE(GDCM)
+ # If gdcm found
+ IF(GDCM_FOUND)
+ INCLUDE(${GDCM_USE_FILE})
+
+ IF(NOT ${GDCM_MAJOR_VERSION} EQUAL 2)
+ MESSAGE(FATAL_ERROR "gdcm version 2 needed. found ${GDCM_MAJOR_VERSION}.${GDCM_MINOR_VERSION}.${GDCM_BUILD_VERSION}. Set GDCM_DIR to the gdcm version 2 directory")
+ ENDIF(NOT ${GDCM_MAJOR_VERSION} EQUAL 2)
+
+ CREA_DEFINE( USE_GDCM2 )
+ CREA_DEFINE_WITH_VAL( GDCM_NAME_SPACE gdcm )
+
+ MESSAGE ( STATUS "Looking for GDCM2... found")
+ MESSAGE ( STATUS "* Dir = ${GDCM_DIR}")
+ MESSAGE ( STATUS "* Version = ${GDCM_MAJOR_VERSION}.${GDCM_MINOR_VERSION}.${GDCM_BUILD_VERSION}")
+ MESSAGE ( STATUS "* Namespace = ${GDCM_NAME_SPACE}")
+
+ # Test that GDCM_NAME_SPACE is **NOT** "gdcm" or will conflict with
+ # embedded gdcm in ITK and will result in hard seg faults !
+ IF(USE_ITK)
+ IF (GDCM_NAME_SPACE STREQUAL "gdcm")
+ MESSAGE(FATAL_ERROR "GDCM_NAME_SPACE value is 'gdcm' which conflicts with ITK embededd gdcm namespace : rebuild gdcm with another GDCM_NAME_SPACE value")
+ ENDIF (GDCM_NAME_SPACE STREQUAL "gdcm")
+ ENDIF(USE_ITK)
+
+ MARK_AS_ADVANCED(GDCM_DIR)
+
+ SET(GDCM_LIBRARIES
+ ${GDCM_LIBRARIES}
+ )
+
+# TODO : Test that GDCM was built with option "vtkgdcm"
+ IF(USE_GDCM_VTK)
+ IF(USE_VTK)
+ SET(GDCM_LIBRARIES
+ ${GDCM_LIBRARIES}
+ vtkgdcm
+ )
+ ENDIF(USE_VTK)
+ ENDIF(USE_GDCM_VTK)
+
+ ENDIF(GDCM_FOUND)
+ENDIF(USE_GDCM2)
+
+#-----------------------------------------------------------------------------
+
#-----------------------------------------------------------------------------
IF(USE_WXWIDGETS)
INCLUDE(${CREA_CMAKE_DIR}/CREAMacro_wxWidgets.cmake)
#
ELSE(WIN32)
+ # CMake 2.6:
+ # technically those packages are not required
+ # since one can still use the Motif/X11 version and not the gtk one:
+ FIND_PACKAGE(PkgConfig)
+ pkg_check_modules (GTK2 gtk+-2.0)
+ #MESSAGE("${GTK2_INCLUDE_DIRS}")
+ # Can I require all my user to have the gl lib on linux, even if they do not really need it...
+ SET(WXGLCANVASLIBS "gl")
# GTK2
- INCLUDE(${CREA_CMAKE_DIR}/FindGTK2.cmake)
+ # INCLUDE(${CREA_CMAKE_DIR}/FindGTK2_new.cmake)
# WX
# LG : Do not force but use what is installed !
# SET(wxWidgets_USE_LIBS base core gl)
- FIND_PACKAGE( wxWidgets REQUIRED)
+ #FIND_PACKAGE( GTK REQUIRED)
+# FIND_PACKAGE( wxWidgets REQUIRED)
+ FIND_PACKAGE(wxWidgets COMPONENTS base core adv ${WXGLCANVASLIBS})
#
IF(wxWidgets_FOUND)
MESSAGE(STATUS "Looking for wxWidgets... found ${wxWidgets_CONFIG_EXECUTABLE}")
LINK_DIRECTORIES(${GTK2_LIBRARY_DIRS})
LINK_LIBRARIES(${GTK2_LIBRARIES})
# WX
+
+
+# INCLUDE( ${GTK_USE_FILE} )
INCLUDE( ${wxWidgets_USE_FILE} )
MARK_AS_ADVANCED(wxWidgets_CONFIG_EXECUTABLE)
SET(WXWIDGETS_LIBRARIES
${GTK2_LIBRARIES}
+ #${GTK_LIBRARIES}
${wxWidgets_LIBRARIES}
)
ENDIF(WIN32)
# in the FIND_PATH() and FIND_LIBRARY() calls
INCLUDE(UsePkgConfig)
- PKGCONFIG(gtk-2.0 _GTK22IncDir _GTK22LinkDir _GTK22LinkFlags _GTK22Cflags)
+# PKGCONFIG
+FindPkgConfig(gtk-2.0 _GTK22IncDir _GTK22LinkDir _GTK22LinkFlags _GTK22Cflags)
+
+# pkg_search_module(<PREFIX> [REQUIRED] <MODULE> [<MODULE>]*)
+# checks for given modules and uses the first working one
FIND_PATH(GTK2_GTK_INCLUDE_PATH gtk/gtk.h
$ENV{GTK2_HOME}
SUBDIRS(creaSample_MessageManager)
SUBDIRS(creaSample_preprocessor)
+SUBDIRS(creaSample_VtkBasicSlicer)