annotate Resources/CMake/DcmtkConfiguration.cmake @ 2193:6ac6193a7935

fix a vulnerability in dcmtk 3.6.0
author Sebastien Jodogne <s.jodogne@gmail.com>
date Fri, 02 Dec 2016 16:04:00 +0100
parents 8b51b133bb8b
children 9f3414878c02
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
rev   line source
1914
501769757bf9 flag to remove network support in dcmtk, removal of unneeded sources in static builds
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1883
diff changeset
1 if (NOT DEFINED ENABLE_DCMTK_NETWORKING)
501769757bf9 flag to remove network support in dcmtk, removal of unneeded sources in static builds
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1883
diff changeset
2 set(ENABLE_DCMTK_NETWORKING ON)
501769757bf9 flag to remove network support in dcmtk, removal of unneeded sources in static builds
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1883
diff changeset
3 endif()
501769757bf9 flag to remove network support in dcmtk, removal of unneeded sources in static builds
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1883
diff changeset
4
929
401a8273fd71 dos2unix
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 890
diff changeset
5 if (STATIC_BUILD OR NOT USE_SYSTEM_DCMTK)
1951
01de36d949c3 Possibility to use forthcoming DCMTK 3.6.1 in static builds (instead of 3.6.0)
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1943
diff changeset
6 if (USE_DCMTK_361)
01de36d949c3 Possibility to use forthcoming DCMTK 3.6.1 in static builds (instead of 3.6.0)
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1943
diff changeset
7 SET(DCMTK_VERSION_NUMBER 361)
01de36d949c3 Possibility to use forthcoming DCMTK 3.6.1 in static builds (instead of 3.6.0)
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1943
diff changeset
8 SET(DCMTK_PACKAGE_VERSION "3.6.1")
01de36d949c3 Possibility to use forthcoming DCMTK 3.6.1 in static builds (instead of 3.6.0)
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1943
diff changeset
9 SET(DCMTK_SOURCES_DIR ${CMAKE_BINARY_DIR}/dcmtk-3.6.1_20160216)
2186
8b51b133bb8b move of third party downloads to the main server
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 2157
diff changeset
10 SET(DCMTK_URL "http://www.orthanc-server.com/downloads/third-party/dcmtk-3.6.1_20160216.tar.gz")
1951
01de36d949c3 Possibility to use forthcoming DCMTK 3.6.1 in static builds (instead of 3.6.0)
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1943
diff changeset
11 SET(DCMTK_MD5 "273c8a544b9fe09b8a4fb4eb51df8e52")
01de36d949c3 Possibility to use forthcoming DCMTK 3.6.1 in static builds (instead of 3.6.0)
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1943
diff changeset
12 SET(DCMTK_PATCH_SPEED "${ORTHANC_ROOT}/Resources/Patches/dcmtk-3.6.1-speed.patch")
01de36d949c3 Possibility to use forthcoming DCMTK 3.6.1 in static builds (instead of 3.6.0)
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1943
diff changeset
13
01de36d949c3 Possibility to use forthcoming DCMTK 3.6.1 in static builds (instead of 3.6.0)
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1943
diff changeset
14 macro(DCMTK_UNSET)
01de36d949c3 Possibility to use forthcoming DCMTK 3.6.1 in static builds (instead of 3.6.0)
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1943
diff changeset
15 endmacro()
01de36d949c3 Possibility to use forthcoming DCMTK 3.6.1 in static builds (instead of 3.6.0)
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1943
diff changeset
16
01de36d949c3 Possibility to use forthcoming DCMTK 3.6.1 in static builds (instead of 3.6.0)
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1943
diff changeset
17 set(DCMTK_BINARY_DIR ${DCMTK_SOURCES_DIR}/)
01de36d949c3 Possibility to use forthcoming DCMTK 3.6.1 in static builds (instead of 3.6.0)
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1943
diff changeset
18 set(DCMTK_CMAKE_INCLUDE ${DCMTK_SOURCES_DIR}/)
01de36d949c3 Possibility to use forthcoming DCMTK 3.6.1 in static builds (instead of 3.6.0)
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1943
diff changeset
19 add_definitions(-DDCMTK_INSIDE_LOG4CPLUS=1)
01de36d949c3 Possibility to use forthcoming DCMTK 3.6.1 in static builds (instead of 3.6.0)
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1943
diff changeset
20 else()
01de36d949c3 Possibility to use forthcoming DCMTK 3.6.1 in static builds (instead of 3.6.0)
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1943
diff changeset
21 SET(DCMTK_VERSION_NUMBER 360)
01de36d949c3 Possibility to use forthcoming DCMTK 3.6.1 in static builds (instead of 3.6.0)
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1943
diff changeset
22 SET(DCMTK_PACKAGE_VERSION "3.6.0")
01de36d949c3 Possibility to use forthcoming DCMTK 3.6.1 in static builds (instead of 3.6.0)
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1943
diff changeset
23 SET(DCMTK_SOURCES_DIR ${CMAKE_BINARY_DIR}/dcmtk-3.6.0)
2186
8b51b133bb8b move of third party downloads to the main server
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 2157
diff changeset
24 SET(DCMTK_URL "http://www.orthanc-server.com/downloads/third-party/dcmtk-3.6.0.zip")
1951
01de36d949c3 Possibility to use forthcoming DCMTK 3.6.1 in static builds (instead of 3.6.0)
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1943
diff changeset
25 SET(DCMTK_MD5 "219ad631b82031806147e4abbfba4fa4")
01de36d949c3 Possibility to use forthcoming DCMTK 3.6.1 in static builds (instead of 3.6.0)
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1943
diff changeset
26 SET(DCMTK_PATCH_SPEED "${ORTHANC_ROOT}/Resources/Patches/dcmtk-3.6.0-speed.patch")
01de36d949c3 Possibility to use forthcoming DCMTK 3.6.1 in static builds (instead of 3.6.0)
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1943
diff changeset
27 SET(DCMTK_PATCH_MINGW64 "${ORTHANC_ROOT}/Resources/Patches/dcmtk-3.6.0-mingw64.patch")
01de36d949c3 Possibility to use forthcoming DCMTK 3.6.1 in static builds (instead of 3.6.0)
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1943
diff changeset
28 endif()
1537
fbf763bb1fa3 error detection in patches
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1415
diff changeset
29
fbf763bb1fa3 error detection in patches
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1415
diff changeset
30 if (IS_DIRECTORY "${DCMTK_SOURCES_DIR}")
fbf763bb1fa3 error detection in patches
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1415
diff changeset
31 set(FirstRun OFF)
fbf763bb1fa3 error detection in patches
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1415
diff changeset
32 else()
fbf763bb1fa3 error detection in patches
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1415
diff changeset
33 set(FirstRun ON)
fbf763bb1fa3 error detection in patches
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1415
diff changeset
34 endif()
fbf763bb1fa3 error detection in patches
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1415
diff changeset
35
fbf763bb1fa3 error detection in patches
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1415
diff changeset
36 DownloadPackage(${DCMTK_MD5} ${DCMTK_URL} "${DCMTK_SOURCES_DIR}")
929
401a8273fd71 dos2unix
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 890
diff changeset
37
2152
cbebc5d072b0 Use of DCMTK 3.6.1 dictionary of private tags in standalone builds
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 2150
diff changeset
38
2157
f75611abd407 cmake option USE_DCMTK_361_PRIVATE_DIC
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 2152
diff changeset
39 if (FirstRun AND
f75611abd407 cmake option USE_DCMTK_361_PRIVATE_DIC
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 2152
diff changeset
40 NOT USE_DCMTK_361)
f75611abd407 cmake option USE_DCMTK_361_PRIVATE_DIC
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 2152
diff changeset
41 if (USE_DCMTK_361_PRIVATE_DIC)
f75611abd407 cmake option USE_DCMTK_361_PRIVATE_DIC
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 2152
diff changeset
42 # If using DCMTK 3.6.0, backport the "private.dic" file from DCMTK
f75611abd407 cmake option USE_DCMTK_361_PRIVATE_DIC
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 2152
diff changeset
43 # 3.6.1 snapshot. This adds support for more private tags, and
f75611abd407 cmake option USE_DCMTK_361_PRIVATE_DIC
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 2152
diff changeset
44 # fixes some import problems with Philips MRI Achieva.
f75611abd407 cmake option USE_DCMTK_361_PRIVATE_DIC
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 2152
diff changeset
45 message("Using the dictionary of private tags from DCMTK 3.6.1")
f75611abd407 cmake option USE_DCMTK_361_PRIVATE_DIC
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 2152
diff changeset
46 configure_file(
f75611abd407 cmake option USE_DCMTK_361_PRIVATE_DIC
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 2152
diff changeset
47 ${ORTHANC_ROOT}/Resources/Patches/dcmtk-3.6.1-private.dic
f75611abd407 cmake option USE_DCMTK_361_PRIVATE_DIC
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 2152
diff changeset
48 ${DCMTK_SOURCES_DIR}/dcmdata/data/private.dic
f75611abd407 cmake option USE_DCMTK_361_PRIVATE_DIC
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 2152
diff changeset
49 COPYONLY)
f75611abd407 cmake option USE_DCMTK_361_PRIVATE_DIC
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 2152
diff changeset
50 else()
f75611abd407 cmake option USE_DCMTK_361_PRIVATE_DIC
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 2152
diff changeset
51 message("Using the dictionary of private tags from DCMTK 3.6.0")
f75611abd407 cmake option USE_DCMTK_361_PRIVATE_DIC
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 2152
diff changeset
52 endif()
2193
6ac6193a7935 fix a vulnerability in dcmtk 3.6.0
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 2186
diff changeset
53
6ac6193a7935 fix a vulnerability in dcmtk 3.6.0
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 2186
diff changeset
54 # Patches specific to DCMTK 3.6.0
6ac6193a7935 fix a vulnerability in dcmtk 3.6.0
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 2186
diff changeset
55 execute_process(
6ac6193a7935 fix a vulnerability in dcmtk 3.6.0
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 2186
diff changeset
56 COMMAND ${PATCH_EXECUTABLE} -p0 -N -i ${ORTHANC_ROOT}/Resources/Patches/dcmtk-3.6.0-dulparse-vulnerability.patch
6ac6193a7935 fix a vulnerability in dcmtk 3.6.0
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 2186
diff changeset
57 WORKING_DIRECTORY ${CMAKE_BINARY_DIR}
6ac6193a7935 fix a vulnerability in dcmtk 3.6.0
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 2186
diff changeset
58 RESULT_VARIABLE Failure
6ac6193a7935 fix a vulnerability in dcmtk 3.6.0
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 2186
diff changeset
59 )
6ac6193a7935 fix a vulnerability in dcmtk 3.6.0
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 2186
diff changeset
60
6ac6193a7935 fix a vulnerability in dcmtk 3.6.0
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 2186
diff changeset
61 if (Failure)
6ac6193a7935 fix a vulnerability in dcmtk 3.6.0
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 2186
diff changeset
62 message(FATAL_ERROR "Error while patching a file")
6ac6193a7935 fix a vulnerability in dcmtk 3.6.0
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 2186
diff changeset
63 endif()
2152
cbebc5d072b0 Use of DCMTK 3.6.1 dictionary of private tags in standalone builds
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 2150
diff changeset
64 endif()
cbebc5d072b0 Use of DCMTK 3.6.1 dictionary of private tags in standalone builds
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 2150
diff changeset
65
cbebc5d072b0 Use of DCMTK 3.6.1 dictionary of private tags in standalone builds
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 2150
diff changeset
66
1414
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1377
diff changeset
67 IF (CMAKE_CROSSCOMPILING)
929
401a8273fd71 dos2unix
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 890
diff changeset
68 SET(C_CHAR_UNSIGNED 1 CACHE INTERNAL "Whether char is unsigned.")
401a8273fd71 dos2unix
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 890
diff changeset
69 ENDIF()
1634
c095b0ddeea6 improvement
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1546
diff changeset
70 SET(DCMTK_SOURCE_DIR ${DCMTK_SOURCES_DIR})
929
401a8273fd71 dos2unix
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 890
diff changeset
71 include(${DCMTK_SOURCES_DIR}/CMake/CheckFunctionWithHeaderExists.cmake)
401a8273fd71 dos2unix
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 890
diff changeset
72 include(${DCMTK_SOURCES_DIR}/CMake/GenerateDCMTKConfigure.cmake)
401a8273fd71 dos2unix
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 890
diff changeset
73
401a8273fd71 dos2unix
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 890
diff changeset
74 if ("${CMAKE_SYSTEM_VERSION}" STREQUAL "LinuxStandardBase")
401a8273fd71 dos2unix
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 890
diff changeset
75 set(HAVE_SSTREAM 1)
401a8273fd71 dos2unix
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 890
diff changeset
76 set(HAVE_PROTOTYPE_BZERO 1)
401a8273fd71 dos2unix
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 890
diff changeset
77 set(HAVE_PROTOTYPE_GETHOSTNAME 1)
401a8273fd71 dos2unix
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 890
diff changeset
78 set(HAVE_PROTOTYPE_GETSOCKOPT 1)
401a8273fd71 dos2unix
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 890
diff changeset
79 set(HAVE_PROTOTYPE_SETSOCKOPT 1)
401a8273fd71 dos2unix
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 890
diff changeset
80 set(HAVE_PROTOTYPE_CONNECT 1)
401a8273fd71 dos2unix
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 890
diff changeset
81 set(HAVE_PROTOTYPE_BIND 1)
401a8273fd71 dos2unix
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 890
diff changeset
82 set(HAVE_PROTOTYPE_ACCEPT 1)
401a8273fd71 dos2unix
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 890
diff changeset
83 set(HAVE_PROTOTYPE_SETSOCKNAME 1)
401a8273fd71 dos2unix
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 890
diff changeset
84 set(HAVE_PROTOTYPE_GETSOCKNAME 1)
401a8273fd71 dos2unix
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 890
diff changeset
85 endif()
401a8273fd71 dos2unix
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 890
diff changeset
86
1149
dd6d7fd82da9 fix version of dcmtk
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1057
diff changeset
87 set(DCMTK_PACKAGE_VERSION_SUFFIX "")
1634
c095b0ddeea6 improvement
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1546
diff changeset
88 set(DCMTK_PACKAGE_VERSION_NUMBER ${DCMTK_VERSION_NUMBER})
1149
dd6d7fd82da9 fix version of dcmtk
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1057
diff changeset
89
929
401a8273fd71 dos2unix
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 890
diff changeset
90 CONFIGURE_FILE(
401a8273fd71 dos2unix
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 890
diff changeset
91 ${DCMTK_SOURCES_DIR}/CMake/osconfig.h.in
401a8273fd71 dos2unix
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 890
diff changeset
92 ${DCMTK_SOURCES_DIR}/config/include/dcmtk/config/osconfig.h)
401a8273fd71 dos2unix
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 890
diff changeset
93
1951
01de36d949c3 Possibility to use forthcoming DCMTK 3.6.1 in static builds (instead of 3.6.0)
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1943
diff changeset
94 if (USE_DCMTK_361)
01de36d949c3 Possibility to use forthcoming DCMTK 3.6.1 in static builds (instead of 3.6.0)
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1943
diff changeset
95 # This step must be after the generation of "osconfig.h"
01de36d949c3 Possibility to use forthcoming DCMTK 3.6.1 in static builds (instead of 3.6.0)
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1943
diff changeset
96 INSPECT_FUNDAMENTAL_ARITHMETIC_TYPES()
01de36d949c3 Possibility to use forthcoming DCMTK 3.6.1 in static builds (instead of 3.6.0)
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1943
diff changeset
97 endif()
01de36d949c3 Possibility to use forthcoming DCMTK 3.6.1 in static builds (instead of 3.6.0)
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1943
diff changeset
98
929
401a8273fd71 dos2unix
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 890
diff changeset
99 AUX_SOURCE_DIRECTORY(${DCMTK_SOURCES_DIR}/dcmdata/libsrc DCMTK_SOURCES)
401a8273fd71 dos2unix
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 890
diff changeset
100 AUX_SOURCE_DIRECTORY(${DCMTK_SOURCES_DIR}/ofstd/libsrc DCMTK_SOURCES)
401a8273fd71 dos2unix
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 890
diff changeset
101
1914
501769757bf9 flag to remove network support in dcmtk, removal of unneeded sources in static builds
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1883
diff changeset
102 if (ENABLE_DCMTK_NETWORKING)
501769757bf9 flag to remove network support in dcmtk, removal of unneeded sources in static builds
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1883
diff changeset
103 AUX_SOURCE_DIRECTORY(${DCMTK_SOURCES_DIR}/dcmnet/libsrc DCMTK_SOURCES)
501769757bf9 flag to remove network support in dcmtk, removal of unneeded sources in static builds
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1883
diff changeset
104 include_directories(
501769757bf9 flag to remove network support in dcmtk, removal of unneeded sources in static builds
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1883
diff changeset
105 ${DCMTK_SOURCES_DIR}/dcmnet/include
501769757bf9 flag to remove network support in dcmtk, removal of unneeded sources in static builds
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1883
diff changeset
106 )
501769757bf9 flag to remove network support in dcmtk, removal of unneeded sources in static builds
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1883
diff changeset
107 endif()
929
401a8273fd71 dos2unix
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 890
diff changeset
108
401a8273fd71 dos2unix
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 890
diff changeset
109 if (ENABLE_JPEG)
401a8273fd71 dos2unix
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 890
diff changeset
110 AUX_SOURCE_DIRECTORY(${DCMTK_SOURCES_DIR}/dcmjpeg/libsrc DCMTK_SOURCES)
401a8273fd71 dos2unix
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 890
diff changeset
111 AUX_SOURCE_DIRECTORY(${DCMTK_SOURCES_DIR}/dcmjpeg/libijg8 DCMTK_SOURCES)
401a8273fd71 dos2unix
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 890
diff changeset
112 AUX_SOURCE_DIRECTORY(${DCMTK_SOURCES_DIR}/dcmjpeg/libijg12 DCMTK_SOURCES)
401a8273fd71 dos2unix
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 890
diff changeset
113 AUX_SOURCE_DIRECTORY(${DCMTK_SOURCES_DIR}/dcmjpeg/libijg16 DCMTK_SOURCES)
401a8273fd71 dos2unix
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 890
diff changeset
114 include_directories(
401a8273fd71 dos2unix
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 890
diff changeset
115 ${DCMTK_SOURCES_DIR}/dcmjpeg/include
401a8273fd71 dos2unix
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 890
diff changeset
116 ${DCMTK_SOURCES_DIR}/dcmjpeg/libijg8
401a8273fd71 dos2unix
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 890
diff changeset
117 ${DCMTK_SOURCES_DIR}/dcmjpeg/libijg12
401a8273fd71 dos2unix
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 890
diff changeset
118 ${DCMTK_SOURCES_DIR}/dcmjpeg/libijg16
401a8273fd71 dos2unix
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 890
diff changeset
119 ${DCMTK_SOURCES_DIR}/dcmimgle/include
401a8273fd71 dos2unix
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 890
diff changeset
120 )
401a8273fd71 dos2unix
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 890
diff changeset
121 list(REMOVE_ITEM DCMTK_SOURCES
401a8273fd71 dos2unix
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 890
diff changeset
122 ${DCMTK_SOURCES_DIR}/dcmjpeg/libsrc/ddpiimpl.cc
1914
501769757bf9 flag to remove network support in dcmtk, removal of unneeded sources in static builds
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1883
diff changeset
123
501769757bf9 flag to remove network support in dcmtk, removal of unneeded sources in static builds
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1883
diff changeset
124 # Disable support for encoding JPEG (modification in Orthanc 1.0.1)
501769757bf9 flag to remove network support in dcmtk, removal of unneeded sources in static builds
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1883
diff changeset
125 ${DCMTK_SOURCES_DIR}/dcmjpeg/libsrc/djcodece.cc
501769757bf9 flag to remove network support in dcmtk, removal of unneeded sources in static builds
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1883
diff changeset
126 ${DCMTK_SOURCES_DIR}/dcmjpeg/libsrc/djencsv1.cc
501769757bf9 flag to remove network support in dcmtk, removal of unneeded sources in static builds
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1883
diff changeset
127 ${DCMTK_SOURCES_DIR}/dcmjpeg/libsrc/djencbas.cc
501769757bf9 flag to remove network support in dcmtk, removal of unneeded sources in static builds
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1883
diff changeset
128 ${DCMTK_SOURCES_DIR}/dcmjpeg/libsrc/djencpro.cc
501769757bf9 flag to remove network support in dcmtk, removal of unneeded sources in static builds
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1883
diff changeset
129 ${DCMTK_SOURCES_DIR}/dcmjpeg/libsrc/djenclol.cc
501769757bf9 flag to remove network support in dcmtk, removal of unneeded sources in static builds
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1883
diff changeset
130 ${DCMTK_SOURCES_DIR}/dcmjpeg/libsrc/djencode.cc
501769757bf9 flag to remove network support in dcmtk, removal of unneeded sources in static builds
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1883
diff changeset
131 ${DCMTK_SOURCES_DIR}/dcmjpeg/libsrc/djencext.cc
501769757bf9 flag to remove network support in dcmtk, removal of unneeded sources in static builds
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1883
diff changeset
132 ${DCMTK_SOURCES_DIR}/dcmjpeg/libsrc/djencsps.cc
929
401a8273fd71 dos2unix
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 890
diff changeset
133 )
401a8273fd71 dos2unix
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 890
diff changeset
134 endif()
401a8273fd71 dos2unix
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 890
diff changeset
135
401a8273fd71 dos2unix
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 890
diff changeset
136
401a8273fd71 dos2unix
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 890
diff changeset
137 if (ENABLE_JPEG_LOSSLESS)
401a8273fd71 dos2unix
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 890
diff changeset
138 AUX_SOURCE_DIRECTORY(${DCMTK_SOURCES_DIR}/dcmjpls/libsrc DCMTK_SOURCES)
401a8273fd71 dos2unix
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 890
diff changeset
139 AUX_SOURCE_DIRECTORY(${DCMTK_SOURCES_DIR}/dcmjpls/libcharls DCMTK_SOURCES)
401a8273fd71 dos2unix
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 890
diff changeset
140 include_directories(
401a8273fd71 dos2unix
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 890
diff changeset
141 ${DCMTK_SOURCES_DIR}/dcmjpeg/include
401a8273fd71 dos2unix
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 890
diff changeset
142 ${DCMTK_SOURCES_DIR}/dcmjpls/include
401a8273fd71 dos2unix
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 890
diff changeset
143 ${DCMTK_SOURCES_DIR}/dcmjpls/libcharls
401a8273fd71 dos2unix
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 890
diff changeset
144 )
401a8273fd71 dos2unix
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 890
diff changeset
145 list(REMOVE_ITEM DCMTK_SOURCES
401a8273fd71 dos2unix
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 890
diff changeset
146 ${DCMTK_SOURCES_DIR}/dcmjpls/libsrc/djcodece.cc
1914
501769757bf9 flag to remove network support in dcmtk, removal of unneeded sources in static builds
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1883
diff changeset
147
501769757bf9 flag to remove network support in dcmtk, removal of unneeded sources in static builds
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1883
diff changeset
148 # Disable support for encoding JPEG-LS (modification in Orthanc 1.0.1)
501769757bf9 flag to remove network support in dcmtk, removal of unneeded sources in static builds
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1883
diff changeset
149 ${DCMTK_SOURCES_DIR}/dcmjpls/libsrc/djencode.cc
929
401a8273fd71 dos2unix
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 890
diff changeset
150 )
401a8273fd71 dos2unix
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 890
diff changeset
151 list(APPEND DCMTK_SOURCES
401a8273fd71 dos2unix
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 890
diff changeset
152 ${DCMTK_SOURCES_DIR}/dcmjpeg/libsrc/djrplol.cc
401a8273fd71 dos2unix
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 890
diff changeset
153 )
401a8273fd71 dos2unix
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 890
diff changeset
154 endif()
401a8273fd71 dos2unix
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 890
diff changeset
155
401a8273fd71 dos2unix
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 890
diff changeset
156
401a8273fd71 dos2unix
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 890
diff changeset
157 # Source for the logging facility of DCMTK
401a8273fd71 dos2unix
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 890
diff changeset
158 AUX_SOURCE_DIRECTORY(${DCMTK_SOURCES_DIR}/oflog/libsrc DCMTK_SOURCES)
401a8273fd71 dos2unix
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 890
diff changeset
159 if (${CMAKE_SYSTEM_NAME} STREQUAL "Linux" OR
930
27d256e0b458 integration mainline -> mac
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 928 929
diff changeset
160 ${CMAKE_SYSTEM_NAME} STREQUAL "Darwin" OR
1337
afaa55d42ddd FreeBSD support
jodogne
parents: 1334
diff changeset
161 ${CMAKE_SYSTEM_NAME} STREQUAL "FreeBSD" OR
929
401a8273fd71 dos2unix
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 890
diff changeset
162 ${CMAKE_SYSTEM_NAME} STREQUAL "kFreeBSD")
401a8273fd71 dos2unix
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 890
diff changeset
163 list(REMOVE_ITEM DCMTK_SOURCES
1951
01de36d949c3 Possibility to use forthcoming DCMTK 3.6.1 in static builds (instead of 3.6.0)
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1943
diff changeset
164 ${DCMTK_SOURCES_DIR}/oflog/libsrc/clfsap.cc
929
401a8273fd71 dos2unix
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 890
diff changeset
165 ${DCMTK_SOURCES_DIR}/oflog/libsrc/windebap.cc
401a8273fd71 dos2unix
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 890
diff changeset
166 ${DCMTK_SOURCES_DIR}/oflog/libsrc/winsock.cc
401a8273fd71 dos2unix
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 890
diff changeset
167 )
1361
94ffb597d297 refactoring of C-Find SCP
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1337
diff changeset
168
1362
bf6db7d2f8b1 fix slow DCMTK problem
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1361
diff changeset
169 execute_process(
1951
01de36d949c3 Possibility to use forthcoming DCMTK 3.6.1 in static builds (instead of 3.6.0)
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1943
diff changeset
170 COMMAND ${PATCH_EXECUTABLE} -p0 -N -i ${DCMTK_PATCH_SPEED}
1362
bf6db7d2f8b1 fix slow DCMTK problem
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1361
diff changeset
171 WORKING_DIRECTORY ${CMAKE_BINARY_DIR}
1537
fbf763bb1fa3 error detection in patches
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1415
diff changeset
172 RESULT_VARIABLE Failure
1362
bf6db7d2f8b1 fix slow DCMTK problem
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1361
diff changeset
173 )
bf6db7d2f8b1 fix slow DCMTK problem
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1361
diff changeset
174
1537
fbf763bb1fa3 error detection in patches
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1415
diff changeset
175 if (Failure AND FirstRun)
fbf763bb1fa3 error detection in patches
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1415
diff changeset
176 message(FATAL_ERROR "Error while patching a file")
fbf763bb1fa3 error detection in patches
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1415
diff changeset
177 endif()
fbf763bb1fa3 error detection in patches
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1415
diff changeset
178
929
401a8273fd71 dos2unix
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 890
diff changeset
179 elseif (${CMAKE_SYSTEM_NAME} STREQUAL "Windows")
401a8273fd71 dos2unix
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 890
diff changeset
180 list(REMOVE_ITEM DCMTK_SOURCES
401a8273fd71 dos2unix
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 890
diff changeset
181 ${DCMTK_SOURCES_DIR}/oflog/libsrc/unixsock.cc
401a8273fd71 dos2unix
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 890
diff changeset
182 )
401a8273fd71 dos2unix
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 890
diff changeset
183
1951
01de36d949c3 Possibility to use forthcoming DCMTK 3.6.1 in static builds (instead of 3.6.0)
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1943
diff changeset
184 if (CMAKE_COMPILER_IS_GNUCXX AND DCMTK_PATCH_MINGW64)
929
401a8273fd71 dos2unix
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 890
diff changeset
185 # This is a patch for MinGW64
401a8273fd71 dos2unix
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 890
diff changeset
186 execute_process(
1951
01de36d949c3 Possibility to use forthcoming DCMTK 3.6.1 in static builds (instead of 3.6.0)
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1943
diff changeset
187 COMMAND ${PATCH_EXECUTABLE} -p0 -N -i ${DCMTK_PATCH_MINGW64}
929
401a8273fd71 dos2unix
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 890
diff changeset
188 WORKING_DIRECTORY ${CMAKE_BINARY_DIR}
1537
fbf763bb1fa3 error detection in patches
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1415
diff changeset
189 RESULT_VARIABLE Failure
929
401a8273fd71 dos2unix
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 890
diff changeset
190 )
1537
fbf763bb1fa3 error detection in patches
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1415
diff changeset
191
fbf763bb1fa3 error detection in patches
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1415
diff changeset
192 if (Failure AND FirstRun)
fbf763bb1fa3 error detection in patches
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1415
diff changeset
193 message(FATAL_ERROR "Error while patching a file")
fbf763bb1fa3 error detection in patches
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1415
diff changeset
194 endif()
929
401a8273fd71 dos2unix
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 890
diff changeset
195 endif()
401a8273fd71 dos2unix
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 890
diff changeset
196
1377
601d34afdab9 patch for recent versions of MinGW
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1362
diff changeset
197 # This patch improves speed, even for Windows
601d34afdab9 patch for recent versions of MinGW
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1362
diff changeset
198 execute_process(
1546
17a3814fd8a1 fix patches on windows
jodogne
parents: 1537
diff changeset
199 COMMAND ${PATCH_EXECUTABLE} -p0 -N
1951
01de36d949c3 Possibility to use forthcoming DCMTK 3.6.1 in static builds (instead of 3.6.0)
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1943
diff changeset
200 INPUT_FILE ${DCMTK_PATCH_SPEED}
1377
601d34afdab9 patch for recent versions of MinGW
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1362
diff changeset
201 WORKING_DIRECTORY ${CMAKE_BINARY_DIR}
1537
fbf763bb1fa3 error detection in patches
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1415
diff changeset
202 RESULT_VARIABLE Failure
1377
601d34afdab9 patch for recent versions of MinGW
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1362
diff changeset
203 )
601d34afdab9 patch for recent versions of MinGW
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1362
diff changeset
204
1537
fbf763bb1fa3 error detection in patches
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1415
diff changeset
205 if (Failure AND FirstRun)
fbf763bb1fa3 error detection in patches
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1415
diff changeset
206 message(FATAL_ERROR "Error while patching a file")
fbf763bb1fa3 error detection in patches
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1415
diff changeset
207 endif()
929
401a8273fd71 dos2unix
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 890
diff changeset
208 endif()
401a8273fd71 dos2unix
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 890
diff changeset
209
401a8273fd71 dos2unix
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 890
diff changeset
210 list(REMOVE_ITEM DCMTK_SOURCES
401a8273fd71 dos2unix
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 890
diff changeset
211 ${DCMTK_SOURCES_DIR}/dcmdata/libsrc/mkdictbi.cc
401a8273fd71 dos2unix
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 890
diff changeset
212 ${DCMTK_SOURCES_DIR}/dcmdata/libsrc/mkdeftag.cc
401a8273fd71 dos2unix
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 890
diff changeset
213 )
401a8273fd71 dos2unix
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 890
diff changeset
214
2150
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 2149
diff changeset
215 if (NOT USE_DCMTK_361)
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 2149
diff changeset
216 # Removing this file is required with DCMTK 3.6.0
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 2149
diff changeset
217 list(REMOVE_ITEM DCMTK_SOURCES
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 2149
diff changeset
218 ${DCMTK_SOURCES_DIR}/dcmdata/libsrc/dcdictbi.cc
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 2149
diff changeset
219 )
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 2149
diff changeset
220 endif()
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 2149
diff changeset
221
1149
dd6d7fd82da9 fix version of dcmtk
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1057
diff changeset
222 #set_source_files_properties(${DCMTK_SOURCES}
dd6d7fd82da9 fix version of dcmtk
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1057
diff changeset
223 # PROPERTIES COMPILE_DEFINITIONS
1636
8c4f1de71f8d improvement
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1634
diff changeset
224 # "PACKAGE_VERSION=\"${DCMTK_PACKAGE_VERSION}\";PACKAGE_VERSION_NUMBER=\"${DCMTK_VERSION_NUMBER}\"")
1149
dd6d7fd82da9 fix version of dcmtk
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1057
diff changeset
225
929
401a8273fd71 dos2unix
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 890
diff changeset
226 # This fixes crashes related to the destruction of the DCMTK OFLogger
401a8273fd71 dos2unix
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 890
diff changeset
227 # http://support.dcmtk.org/docs-snapshot/file_macros.html
401a8273fd71 dos2unix
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 890
diff changeset
228 add_definitions(
401a8273fd71 dos2unix
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 890
diff changeset
229 -DLOG4CPLUS_DISABLE_FATAL=1
1634
c095b0ddeea6 improvement
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1546
diff changeset
230 -DDCMTK_VERSION_NUMBER=${DCMTK_VERSION_NUMBER}
929
401a8273fd71 dos2unix
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 890
diff changeset
231 )
401a8273fd71 dos2unix
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 890
diff changeset
232
401a8273fd71 dos2unix
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 890
diff changeset
233 include_directories(
401a8273fd71 dos2unix
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 890
diff changeset
234 #${DCMTK_SOURCES_DIR}
401a8273fd71 dos2unix
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 890
diff changeset
235 ${DCMTK_SOURCES_DIR}/config/include
401a8273fd71 dos2unix
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 890
diff changeset
236 ${DCMTK_SOURCES_DIR}/ofstd/include
401a8273fd71 dos2unix
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 890
diff changeset
237 ${DCMTK_SOURCES_DIR}/oflog/include
401a8273fd71 dos2unix
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 890
diff changeset
238 ${DCMTK_SOURCES_DIR}/dcmdata/include
401a8273fd71 dos2unix
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 890
diff changeset
239 )
401a8273fd71 dos2unix
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 890
diff changeset
240
401a8273fd71 dos2unix
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 890
diff changeset
241 source_group(ThirdParty\\Dcmtk REGULAR_EXPRESSION ${DCMTK_SOURCES_DIR}/.*)
401a8273fd71 dos2unix
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 890
diff changeset
242
401a8273fd71 dos2unix
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 890
diff changeset
243 set(DCMTK_BUNDLES_LOG4CPLUS 1)
401a8273fd71 dos2unix
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 890
diff changeset
244
401a8273fd71 dos2unix
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 890
diff changeset
245 if (STANDALONE_BUILD)
1770
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1769
diff changeset
246 set(DCMTK_USE_EMBEDDED_DICTIONARIES 1)
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1769
diff changeset
247 set(DCMTK_DICTIONARIES
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1769
diff changeset
248 DICTIONARY_DICOM ${DCMTK_SOURCES_DIR}/dcmdata/data/dicom.dic
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1769
diff changeset
249 DICTIONARY_PRIVATE ${DCMTK_SOURCES_DIR}/dcmdata/data/private.dic
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1769
diff changeset
250 DICTIONARY_DICONDE ${DCMTK_SOURCES_DIR}/dcmdata/data/diconde.dic
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1769
diff changeset
251 )
929
401a8273fd71 dos2unix
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 890
diff changeset
252 else()
1770
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1769
diff changeset
253 set(DCMTK_USE_EMBEDDED_DICTIONARIES 0)
929
401a8273fd71 dos2unix
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 890
diff changeset
254 endif()
401a8273fd71 dos2unix
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 890
diff changeset
255
401a8273fd71 dos2unix
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 890
diff changeset
256 else()
401a8273fd71 dos2unix
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 890
diff changeset
257 # The following line allows to manually add libraries at the
401a8273fd71 dos2unix
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 890
diff changeset
258 # command-line, which is necessary for Ubuntu/Debian packages
401a8273fd71 dos2unix
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 890
diff changeset
259 set(tmp "${DCMTK_LIBRARIES}")
401a8273fd71 dos2unix
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 890
diff changeset
260 include(FindDCMTK)
401a8273fd71 dos2unix
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 890
diff changeset
261 list(APPEND DCMTK_LIBRARIES "${tmp}")
401a8273fd71 dos2unix
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 890
diff changeset
262
1943
bc949ea71fe6 Fix of Debian bug #818512 ("FTBFS: Please install libdcmtk*-dev")
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1914
diff changeset
263 include_directories(${DCMTK_INCLUDE_DIRS})
929
401a8273fd71 dos2unix
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 890
diff changeset
264
401a8273fd71 dos2unix
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 890
diff changeset
265 add_definitions(
401a8273fd71 dos2unix
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 890
diff changeset
266 -DHAVE_CONFIG_H=1
401a8273fd71 dos2unix
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 890
diff changeset
267 )
401a8273fd71 dos2unix
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 890
diff changeset
268
1943
bc949ea71fe6 Fix of Debian bug #818512 ("FTBFS: Please install libdcmtk*-dev")
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1914
diff changeset
269 if (EXISTS "${DCMTK_config_INCLUDE_DIR}/cfunix.h")
bc949ea71fe6 Fix of Debian bug #818512 ("FTBFS: Please install libdcmtk*-dev")
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1914
diff changeset
270 set(DCMTK_CONFIGURATION_FILE "${DCMTK_config_INCLUDE_DIR}/cfunix.h")
bc949ea71fe6 Fix of Debian bug #818512 ("FTBFS: Please install libdcmtk*-dev")
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1914
diff changeset
271 elseif (EXISTS "${DCMTK_config_INCLUDE_DIR}/osconfig.h") # This is for Arch Linux
bc949ea71fe6 Fix of Debian bug #818512 ("FTBFS: Please install libdcmtk*-dev")
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1914
diff changeset
272 set(DCMTK_CONFIGURATION_FILE "${DCMTK_config_INCLUDE_DIR}/osconfig.h")
929
401a8273fd71 dos2unix
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 890
diff changeset
273 else()
1883
71356f41ec2f additional locations for dicom.dic
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1846
diff changeset
274 message(FATAL_ERROR "Please install libdcmtk*-dev")
929
401a8273fd71 dos2unix
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 890
diff changeset
275 endif()
401a8273fd71 dos2unix
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 890
diff changeset
276
401a8273fd71 dos2unix
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 890
diff changeset
277 # Autodetection of the version of DCMTK
401a8273fd71 dos2unix
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 890
diff changeset
278 file(STRINGS
401a8273fd71 dos2unix
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 890
diff changeset
279 "${DCMTK_CONFIGURATION_FILE}"
401a8273fd71 dos2unix
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 890
diff changeset
280 DCMTK_VERSION_NUMBER1 REGEX
401a8273fd71 dos2unix
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 890
diff changeset
281 ".*PACKAGE_VERSION .*")
401a8273fd71 dos2unix
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 890
diff changeset
282
401a8273fd71 dos2unix
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 890
diff changeset
283 string(REGEX REPLACE
401a8273fd71 dos2unix
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 890
diff changeset
284 ".*PACKAGE_VERSION.*\"([0-9]*)\\.([0-9]*)\\.([0-9]*)\"$"
401a8273fd71 dos2unix
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 890
diff changeset
285 "\\1\\2\\3"
401a8273fd71 dos2unix
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 890
diff changeset
286 DCMTK_VERSION_NUMBER
401a8273fd71 dos2unix
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 890
diff changeset
287 ${DCMTK_VERSION_NUMBER1})
401a8273fd71 dos2unix
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 890
diff changeset
288
1770
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1769
diff changeset
289 set(DCMTK_USE_EMBEDDED_DICTIONARIES 0)
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1769
diff changeset
290 endif()
929
401a8273fd71 dos2unix
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 890
diff changeset
291
401a8273fd71 dos2unix
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 890
diff changeset
292
401a8273fd71 dos2unix
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 890
diff changeset
293 add_definitions(-DDCMTK_VERSION_NUMBER=${DCMTK_VERSION_NUMBER})
401a8273fd71 dos2unix
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 890
diff changeset
294 message("DCMTK version: ${DCMTK_VERSION_NUMBER}")
1770
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1769
diff changeset
295
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1769
diff changeset
296
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1769
diff changeset
297 add_definitions(-DDCMTK_USE_EMBEDDED_DICTIONARIES=${DCMTK_USE_EMBEDDED_DICTIONARIES})
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1769
diff changeset
298 if (NOT DCMTK_USE_EMBEDDED_DICTIONARIES)
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1769
diff changeset
299 # Lookup for DICOM dictionaries, if none is specified by the user
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1769
diff changeset
300 if (DCMTK_DICTIONARY_DIR STREQUAL "")
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1769
diff changeset
301 find_path(DCMTK_DICTIONARY_DIR_AUTO dicom.dic
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1769
diff changeset
302 /usr/share/dcmtk
1883
71356f41ec2f additional locations for dicom.dic
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1846
diff changeset
303 /usr/share/libdcmtk1
1770
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1769
diff changeset
304 /usr/share/libdcmtk2
1883
71356f41ec2f additional locations for dicom.dic
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1846
diff changeset
305 /usr/share/libdcmtk3
1770
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1769
diff changeset
306 /usr/share/libdcmtk4
1883
71356f41ec2f additional locations for dicom.dic
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1846
diff changeset
307 /usr/share/libdcmtk5
71356f41ec2f additional locations for dicom.dic
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1846
diff changeset
308 /usr/share/libdcmtk6
2064
e92280e63d8d fix Debian #829608
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1951
diff changeset
309 /usr/share/libdcmtk7
e92280e63d8d fix Debian #829608
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1951
diff changeset
310 /usr/share/libdcmtk8
e92280e63d8d fix Debian #829608
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1951
diff changeset
311 /usr/share/libdcmtk9
1770
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1769
diff changeset
312 /usr/local/share/dcmtk
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1769
diff changeset
313 )
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1769
diff changeset
314
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1769
diff changeset
315 if (${DCMTK_DICTIONARY_DIR_AUTO} MATCHES "DCMTK_DICTIONARY_DIR_AUTO-NOTFOUND")
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1769
diff changeset
316 message(FATAL_ERROR "Cannot locate the DICOM dictionary on this system")
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1769
diff changeset
317 endif()
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1769
diff changeset
318
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1769
diff changeset
319 message("Autodetected path to the DICOM dictionaries: ${DCMTK_DICTIONARY_DIR_AUTO}")
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1769
diff changeset
320 add_definitions(-DDCMTK_DICTIONARY_DIR="${DCMTK_DICTIONARY_DIR_AUTO}")
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1769
diff changeset
321 else()
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1769
diff changeset
322 add_definitions(-DDCMTK_DICTIONARY_DIR="${DCMTK_DICTIONARY_DIR}")
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1769
diff changeset
323 endif()
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1769
diff changeset
324 endif()