]> Creatis software - gdcm.git/blob - CMake/UseGDCM.cmake
no message
[gdcm.git] / CMake / UseGDCM.cmake
1 #
2 # This module is provided as GDCM_USE_FILE by GDCMConfig.cmake.
3 # It can be INCLUDEd in a project to load the needed compiler and linker
4 # settings to use GDCM:
5 #   FIND_PACKAGE(GDCM REQUIRED)
6 #   INCLUDE(${GDCM_USE_FILE})
7 #
8
9 IF(NOT GDCM_USE_FILE_INCLUDED)
10   SET(GDCM_USE_FILE_INCLUDED 1)
11
12   # Load the compiler settings used for GDCM.
13   IF(GDCM_BUILD_SETTINGS_FILE)
14     INCLUDE(${CMAKE_ROOT}/Modules/CMakeImportBuildSettings.cmake)
15     CMAKE_IMPORT_BUILD_SETTINGS(${GDCM_BUILD_SETTINGS_FILE})
16   ENDIF(GDCM_BUILD_SETTINGS_FILE)
17
18   # Add compiler flags needed to use GDCM.
19   SET(CMAKE_C_FLAGS
20     "${CMAKE_C_FLAGS} ${GDCM_REQUIRED_C_FLAGS}")
21   SET(CMAKE_CXX_FLAGS
22     "${CMAKE_CXX_FLAGS} ${GDCM_REQUIRED_CXX_FLAGS}")
23   SET(CMAKE_EXE_LINKER_FLAGS
24     "${CMAKE_EXE_LINKER_FLAGS} ${GDCM_REQUIRED_EXE_LINKER_FLAGS}")
25   SET(CMAKE_SHARED_LINKER_FLAGS
26     "${CMAKE_SHARED_LINKER_FLAGS} ${GDCM_REQUIRED_SHARED_LINKER_FLAGS}")
27   SET(CMAKE_MODULE_LINKER_FLAGS
28     "${CMAKE_MODULE_LINKER_FLAGS} ${GDCM_REQUIRED_MODULE_LINKER_FLAGS}")
29
30   # Add include directories needed to use GDCM.
31   INCLUDE_DIRECTORIES( BEFORE ${GDCM_INCLUDE_DIRS})
32
33   # Add link directories needed to use GDCM.
34   LINK_DIRECTORIES(${GDCM_LIBRARY_DIRS})
35
36   # Add cmake module path.
37   SET(CMAKE_MODULE_PATH ${CMAKE_MODULE_PATH} "${GDCM_CMAKE_DIR}")
38
39   # Use VTK.
40   IF(GDCM_VTK)
41     SET(VTK_DIR ${GDCM_VTK_DIR})
42     FIND_PACKAGE(VTK)
43     IF(VTK_FOUND)
44       INCLUDE(${VTK_USE_FILE})
45       set(GDCM_LIBRARIES  ${GDCM_LIBRARIES}  " vtkgdcm"  )
46     ELSE(VTK_FOUND)
47       MESSAGE("VTK not found in GDCM_VTK_DIR=\"${GDCM_VTK_DIR}\".")
48     ENDIF(VTK_FOUND)
49   ENDIF(GDCM_VTK)
50
51 ENDIF(NOT GDCM_USE_FILE_INCLUDED)