-
Notifications
You must be signed in to change notification settings - Fork 0
/
CMakeLists.txt
134 lines (104 loc) · 5.24 KB
/
CMakeLists.txt
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
# Declare project
PROJECT(DCMTK)
# Minimum CMake version required
CMAKE_MINIMUM_REQUIRED(VERSION 2.6.2)
# Check the build system
INCLUDE(CMake/dcmtkPrepare.cmake NO_POLICY_SCOPE)
#-----------------------------------------------------------------------------
# General project settings to configure DCMTK build process
#-----------------------------------------------------------------------------
# Modules to be built
SET(DCMTK_MODULES ofstd oflog dcmdata dcmimgle
dcmimage dcmjpeg dcmjpls dcmtls dcmnet dcmsr
dcmsign dcmwlm dcmqrdb dcmpstat dcmrt dcmiod dcmfg dcmseg
CACHE STRING "List of modules that should be built.")
#-----------------------------------------------------------------------------
# Include directories
#-----------------------------------------------------------------------------
SET(DCMTK_INCLUDE_DIR ${DCMTK_BINARY_DIR}/config/include)
FOREACH(inc ${DCMTK_MODULES})
LIST(APPEND DCMTK_INCLUDE_DIR ${DCMTK_SOURCE_DIR}/${inc}/include)
ENDFOREACH(inc)
INCLUDE_DIRECTORIES(${DCMTK_INCLUDE_DIR})
#-----------------------------------------------------------------------------
# Prepare osconfig.h
#-----------------------------------------------------------------------------
# add the osconfig.h.in file
CONFIGURE_FILE(${DCMTK_SOURCE_DIR}/CMake/osconfig.h.in
${DCMTK_BINARY_DIR}/config/include/dcmtk/config/osconfig.h)
#-----------------------------------------------------------------------------
# Prepare arith.h
#-----------------------------------------------------------------------------
INSPECT_FUNDAMENTAL_ARITHMETIC_TYPES()
#-----------------------------------------------------------------------------
# Start actual compilation tasks
#-----------------------------------------------------------------------------
# Recurse into subdirectories
FOREACH(module config doxygen ${DCMTK_MODULES})
ADD_SUBDIRECTORY(${module})
ENDFOREACH(module)
INCLUDE(CMake/dcmtkAfterModules.cmake NO_POLICY_SCOPE)
#-----------------------------------------------------------------------------
# Installation tasks
#-----------------------------------------------------------------------------
# Install global headers
INSTALL(FILES ${DCMTK_BINARY_DIR}/config/include/dcmtk/config/osconfig.h
DESTINATION ${DCMTK_INSTALL_INCDIR}/dcmtk/config
COMPONENT include)
# Install DCMTK's general documentation files
INSTALL(FILES ANNOUNCE CHANGES COPYRIGHT CREDITS FAQ HISTORY VERSION
DESTINATION ${DCMTK_INSTALL_DOCDIR}
COMPONENT doc)
#-----------------------------------------------------------------------------
# Create an install configuration files for external projects
#-----------------------------------------------------------------------------
#
# DCMTKTargets.cmake will contain list of executables and libraries produced
# DCMTKConfigVersion.cmake will contain DCMTK version information
# DCMTKConfig.cmake will contain options used to build DCMTK
#
# All three files are created within the build tree's main directory (handled in
# CMake/GenerateCMakeExports.cmake, and are installed to locations (OS-specific
# under the main install dir (handled directly below).
# Only create fully-fledged CMake export files if we have the related commands
INCLUDE(CMake/CheckCMakeCommandExists.cmake)
INCLUDE(CMakePackageConfigHelpers OPTIONAL)
CHECK_CMAKE_COMMAND_EXISTS("CONFIGURE_PACKAGE_CONFIG_FILE")
CHECK_CMAKE_COMMAND_EXISTS("WRITE_BASIC_PACKAGE_VERSION_FILE")
IF(HAVE_CONFIGURE_PACKAGE_CONFIG_FILE AND HAVE_WRITE_BASIC_PACKAGE_VERSION_FILE)
# Create and configure CMake export files
INCLUDE(CMake/GenerateCMakeExports.cmake)
# ${dcmtk_install_config} and ${dcmtk_config_version} are
# defined within CMake/GenerateCMakeExports.cmake.
# Install DCMTKTargets.cmake to install tree
INSTALL(EXPORT DCMTKTargets FILE DCMTKTargets.cmake
DESTINATION ${DCMTK_INSTALL_CMKDIR} COMPONENT cmake)
# Install DCMTKConfigVersion.cmake
INSTALL(FILES ${dcmtk_install_config} ${dcmtk_config_version}
DESTINATION ${DCMTK_INSTALL_CMKDIR} COMPONENT cmake)
ELSE(HAVE_CONFIGURE_PACKAGE_CONFIG_FILE AND HAVE_WRITE_BASIC_PACKAGE_VERSION_FILE)
# Warning that we use old "configure_file" command
MESSAGE(STATUS "Warning: Using old CONFIGURE_FILE() mechanism to produce DCMTKConfig.cmake")
# Actually configure file
CONFIGURE_FILE(${DCMTK_SOURCE_DIR}/CMake/DCMTKConfig.cmake26.in
${DCMTK_BINARY_DIR}/DCMTKConfig.cmake @ONLY)
# Install DCMTK's CMake configuration file
INSTALL(FILES ${DCMTK_BINARY_DIR}/DCMTKConfig.cmake
DESTINATION ${DCMTK_INSTALL_CMKDIR}
COMPONENT cmake)
ENDIF(HAVE_CONFIGURE_PACKAGE_CONFIG_FILE AND HAVE_WRITE_BASIC_PACKAGE_VERSION_FILE)
#-----------------------------------------------------------------------------
# Configure files needed for cross compiling (if any)
#-----------------------------------------------------------------------------
IF(CMAKE_CROSSCOMPILING)
IF(ANDROID)
# setup the CTestCustom.cmake file as appropriate for android
FILE(COPY ${DCMTK_SOURCE_DIR}/CMake/CTest/CTestCustom.cmake
DESTINATION ${CMAKE_BINARY_DIR}
)
# prepare the configuration for unit testing
CONFIGURE_FILE(${DCMTK_SOURCE_DIR}/CMake/CTest/dcmtkCTestConfig.cmake.in
${CMAKE_BINARY_DIR}/dcmtkCTestConfig.cmake @ONLY
)
ENDIF()
ENDIF(CMAKE_CROSSCOMPILING)