]> Creatis software - gdcm.git/blob - CMakeLists.txt
ENH: Apply JMR patch for gethostname
[gdcm.git] / CMakeLists.txt
1 PROJECT(GDCM)
2 CMAKE_MINIMUM_REQUIRED(VERSION 1.8)
3
4 #-----------------------------------------------------------------------------
5 # GDCM version number, usefull for packaging and doxygen doc:
6 SET(GDCM_MAJOR_VERSION 0)
7 SET(GDCM_MINOR_VERSION 7)
8 SET(GDCM_BUILD_VERSION 0)
9 SET(GDCM_VERSION 
10     "${GDCM_MAJOR_VERSION}.${GDCM_MINOR_VERSION}.${GDCM_BUILD_VERSION}")
11
12 #-----------------------------------------------------------------------------
13 # datadir in CMake:
14 SET(GDCM_DATA_DIR "/share/gdcm/" CACHE INTERNAL 
15   "Install location for data (relative to prefix).")
16 MARK_AS_ADVANCED(GDCM_DATA_DIR)
17
18 #-----------------------------------------------------------------------------
19 # Build shared lib by default
20 OPTION(BUILD_SHARED_LIBS "Build GDCM with shared libraries." ON)
21
22 OPTION(GDCM_DEBUG "Turn verbosity of some statement ON." OFF)
23 MARK_AS_ADVANCED(GDCM_DEBUG)
24
25 #-----------------------------------------------------------------------------
26 SET (EXECUTABLE_OUTPUT_PATH ${GDCM_BINARY_DIR}/bin CACHE PATH "Single output directory for building all executables.")
27 SET (LIBRARY_OUTPUT_PATH ${GDCM_BINARY_DIR}/bin CACHE PATH "Single output directory for building all libraries.")
28 MARK_AS_ADVANCED(LIBRARY_OUTPUT_PATH EXECUTABLE_OUTPUT_PATH)
29
30 #-----------------------------------------------------------------------------
31 # Build directory on which many applications depend
32 SUBDIRS(
33   Dicts
34   src
35 )
36 #-----------------------------------------------------------------------------
37 # Example subdir:
38
39 OPTION(BUILD_EXAMPLES "Build GDCM examples." ON)
40 IF(BUILD_EXAMPLES)
41   SUBDIRS(Example)
42 ENDIF(BUILD_EXAMPLES)
43
44 #-----------------------------------------------------------------------------
45 # Adding GDCM_DATA_ROOT
46 FIND_PATH(GDCM_DATA_ROOT gdcm-ACR-LibIDO.acr
47   ${GDCM_SOURCE_DIR}/../gdcmData 
48   $ENV{GDCM_DATA}
49   $ENV{PUB_DICT_PATH}/../../gdcmData
50 )
51
52 # Set the place for the public dictionary, must be set before gdcmConfigure.h
53 SET( GDCM_PUB_DICT_PATH "${CMAKE_INSTALL_PREFIX}${GDCM_DATA_DIR}")
54
55 #-----------------------------------------------------------------------------
56 # SunOS + old gcc fixes:
57 INCLUDE (${CMAKE_ROOT}/Modules/CMakeBackwardCompatibilityCXX.cmake)
58 IF(CMAKE_NO_ANSI_STRING_STREAM)
59   SET(GDCM_NO_ANSI_STRING_STREAM 1)
60 ENDIF(CMAKE_NO_ANSI_STRING_STREAM)
61 INCLUDE (${CMAKE_ROOT}/Modules/TestBigEndian.cmake)
62 TEST_BIG_ENDIAN(GDCM_WORDS_BIGENDIAN)
63
64 INCLUDE (${CMAKE_ROOT}/Modules/CheckIncludeFile.cmake)
65 CHECK_INCLUDE_FILE("stdint.h" GDCM_HAVE_STDINT_H)
66
67 CONFIGURE_FILE(${GDCM_SOURCE_DIR}/gdcmConfigure.h.in
68                ${GDCM_BINARY_DIR}/gdcmConfigure.h @ONLY IMMEDIATE)
69
70 INSTALL_FILES(/include .h gdcmConfigure.h)
71
72 #-----------------------------------------------------------------------------
73 # Add the testing directories
74 OPTION(BUILD_TESTING "Build testing." ON)
75
76 IF(BUILD_TESTING)
77   ENABLE_TESTING()
78   INCLUDE (${CMAKE_ROOT}/Modules/Dart.cmake)
79   MARK_AS_ADVANCED(DART_ROOT)
80   SUBDIRS(Test)
81 ENDIF(BUILD_TESTING)
82
83
84 #-----------------------------------------------------------------------------
85 OPTION(GDCM_VTK "Build VTK-GDCM Lib." OFF)
86 IF(GDCM_VTK)
87   # Search VTK
88   FIND_PACKAGE(VTK)
89   # If vtk found
90   IF(VTK_FOUND)
91     #INCLUDE(${VTK_USE_FILE})
92     SUBDIRS(vtk)
93   ENDIF(VTK_FOUND)
94 ENDIF(GDCM_VTK)
95
96 #-----------------------------------------------------------------------------
97 OPTION(GDCM_WRAP_PYTHON "Wrap GDCM classes into the Python language." OFF)
98 #if wrapping enable
99 IF(GDCM_WRAP_PYTHON)
100   # Search Python libs:
101   FIND_PACKAGE(PythonLibs)
102   # If PythonLibs found
103   IF(PYTHON_LIBRARY)
104     SUBDIRS(gdcmPython)
105   ENDIF(PYTHON_LIBRARY)
106 ENDIF(GDCM_WRAP_PYTHON)
107
108 #-----------------------------------------------------------------------------
109 OPTION(GDCM_DOCUMENTATION "Build source documentation using doxygen." OFF)
110 # if doxygen enable
111 IF(GDCM_DOCUMENTATION)
112   # Search Doxygen:
113   FIND_PACKAGE(Doxygen)
114   IF(DOXYGEN)
115     SUBDIRS(Doc)
116   ENDIF(DOXYGEN)
117 ENDIF(GDCM_DOCUMENTATION)
118