Mercurial > hg > orthanc
annotate Resources/CMake/DcmtkConfiguration.cmake @ 103:f2ecbe7d50b8
detection of dcmtk version
author | Sebastien Jodogne <s.jodogne@gmail.com> |
---|---|
date | Wed, 03 Oct 2012 16:47:02 +0200 |
parents | 428784e59dcd |
children | bb50d0eb4493 |
rev | line source |
---|---|
90 | 1 # We always statically link against DCMTK 3.6.0, as there are many |
2 # differences wrt. DCMTK 3.5.x. | |
3 | |
100
27dc762e3dc8
getting rid of static dcmtk for debian
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
90
diff
changeset
|
4 if (${STATIC_BUILD}) |
103
f2ecbe7d50b8
detection of dcmtk version
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
101
diff
changeset
|
5 SET(DCMTK_VERSION_NUMBER 360) |
8 | 6 SET(DCMTK_SOURCES_DIR ${CMAKE_BINARY_DIR}/dcmtk-3.6.0) |
7 DownloadPackage("ftp://dicom.offis.de/pub/dicom/offis/software/dcmtk/dcmtk360/dcmtk-3.6.0.zip" "${DCMTK_SOURCES_DIR}" "" "") | |
8 | |
9 IF(CMAKE_CROSSCOMPILING) | |
10 SET(C_CHAR_UNSIGNED 1 CACHE INTERNAL "Whether char is unsigned.") | |
11 ENDIF() | |
12 SET(DCMTK_SOURCE_DIR ${CMAKE_BINARY_DIR}/dcmtk-3.6.0) | |
13 include(${DCMTK_SOURCES_DIR}/CMake/CheckFunctionWithHeaderExists.cmake) | |
14 include(${DCMTK_SOURCES_DIR}/CMake/GenerateDCMTKConfigure.cmake) | |
15 CONFIGURE_FILE(${DCMTK_SOURCES_DIR}/CMake/osconfig.h.in | |
16 ${DCMTK_SOURCES_DIR}/config/include/dcmtk/config/osconfig.h) | |
17 | |
18 AUX_SOURCE_DIRECTORY(${DCMTK_SOURCES_DIR}/dcmnet/libsrc THIRD_PARTY_SOURCES) | |
19 AUX_SOURCE_DIRECTORY(${DCMTK_SOURCES_DIR}/dcmdata/libsrc THIRD_PARTY_SOURCES) | |
20 AUX_SOURCE_DIRECTORY(${DCMTK_SOURCES_DIR}/ofstd/libsrc THIRD_PARTY_SOURCES) | |
100
27dc762e3dc8
getting rid of static dcmtk for debian
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
90
diff
changeset
|
21 |
27dc762e3dc8
getting rid of static dcmtk for debian
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
90
diff
changeset
|
22 # Source for the logging facility of DCMTK |
8 | 23 AUX_SOURCE_DIRECTORY(${DCMTK_SOURCES_DIR}/oflog/libsrc THIRD_PARTY_SOURCES) |
24 if (${CMAKE_SYSTEM_NAME} STREQUAL "Linux") | |
25 list(REMOVE_ITEM THIRD_PARTY_SOURCES | |
26 ${DCMTK_SOURCES_DIR}/oflog/libsrc/windebap.cc | |
27 ${DCMTK_SOURCES_DIR}/oflog/libsrc/winsock.cc | |
28 ) | |
29 elseif (${CMAKE_SYSTEM_NAME} STREQUAL "Windows") | |
30 list(REMOVE_ITEM THIRD_PARTY_SOURCES | |
31 ${DCMTK_SOURCES_DIR}/oflog/libsrc/unixsock.cc | |
32 ) | |
33 endif() | |
34 | |
35 list(REMOVE_ITEM THIRD_PARTY_SOURCES | |
36 ${DCMTK_SOURCES_DIR}/dcmdata/libsrc/mkdictbi.cc | |
37 ${DCMTK_SOURCES_DIR}/dcmdata/libsrc/mkdeftag.cc | |
38 ${DCMTK_SOURCES_DIR}/dcmdata/libsrc/dcdictbi.cc | |
39 ) | |
40 | |
41 # This fixes crashes related to the destruction of the DCMTK OFLogger | |
42 # http://support.dcmtk.org/docs-snapshot/file_macros.html | |
103
f2ecbe7d50b8
detection of dcmtk version
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
101
diff
changeset
|
43 add_definitions( |
f2ecbe7d50b8
detection of dcmtk version
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
101
diff
changeset
|
44 -DLOG4CPLUS_DISABLE_FATAL=1 |
f2ecbe7d50b8
detection of dcmtk version
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
101
diff
changeset
|
45 -DDCMTK_VERSION_NUMBER=360 |
f2ecbe7d50b8
detection of dcmtk version
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
101
diff
changeset
|
46 ) |
8 | 47 |
48 include_directories( | |
49 #${DCMTK_SOURCES_DIR} | |
50 ${DCMTK_SOURCES_DIR}/config/include | |
51 ${DCMTK_SOURCES_DIR}/dcmnet/include | |
52 ${DCMTK_SOURCES_DIR}/ofstd/include | |
53 ${DCMTK_SOURCES_DIR}/oflog/include | |
54 ${DCMTK_SOURCES_DIR}/dcmdata/include | |
55 ) | |
56 | |
57 source_group(ThirdParty\\Dcmtk REGULAR_EXPRESSION ${DCMTK_SOURCES_DIR}/.*) | |
100
27dc762e3dc8
getting rid of static dcmtk for debian
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
90
diff
changeset
|
58 |
27dc762e3dc8
getting rid of static dcmtk for debian
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
90
diff
changeset
|
59 set(DCMTK_BUNDLES_LOG4CPLUS 1) |
27dc762e3dc8
getting rid of static dcmtk for debian
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
90
diff
changeset
|
60 |
8 | 61 else() |
62 include(FindDCMTK) | |
63 | |
64 include_directories(${DCMTK_INCLUDE_DIR}) | |
101 | 65 link_libraries(${DCMTK_LIBRARIES} ofstd wrap) |
8 | 66 |
67 add_definitions( | |
68 -DHAVE_CONFIG_H=1 | |
69 ) | |
100
27dc762e3dc8
getting rid of static dcmtk for debian
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
90
diff
changeset
|
70 |
103
f2ecbe7d50b8
detection of dcmtk version
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
101
diff
changeset
|
71 |
f2ecbe7d50b8
detection of dcmtk version
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
101
diff
changeset
|
72 # Autodetection of the version of DCMTK |
f2ecbe7d50b8
detection of dcmtk version
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
101
diff
changeset
|
73 file(STRINGS "${DCMTK_DIR}/config/cfunix.h" DCMTK_VERSION_NUMBER |
f2ecbe7d50b8
detection of dcmtk version
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
101
diff
changeset
|
74 REGEX ".*PACKAGE_VERSION_NUMBER.*") |
f2ecbe7d50b8
detection of dcmtk version
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
101
diff
changeset
|
75 string(REGEX REPLACE ".*PACKAGE_VERSION_NUMBER" "" DCMTK_VERSION_NUMBER1 ${DCMTK_VERSION_NUMBER}) |
f2ecbe7d50b8
detection of dcmtk version
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
101
diff
changeset
|
76 string(STRIP ${DCMTK_VERSION_NUMBER1} DCMTK_VERSION_NUMBER) |
f2ecbe7d50b8
detection of dcmtk version
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
101
diff
changeset
|
77 |
f2ecbe7d50b8
detection of dcmtk version
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
101
diff
changeset
|
78 |
100
27dc762e3dc8
getting rid of static dcmtk for debian
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
90
diff
changeset
|
79 IF (EXISTS "${DCMTK_DIR}/oflog") |
27dc762e3dc8
getting rid of static dcmtk for debian
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
90
diff
changeset
|
80 set(DCMTK_BUNDLES_LOG4CPLUS 1) |
101 | 81 link_libraries(${DCMTK_LIBRARIES} oflog) |
100
27dc762e3dc8
getting rid of static dcmtk for debian
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
90
diff
changeset
|
82 else() |
27dc762e3dc8
getting rid of static dcmtk for debian
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
90
diff
changeset
|
83 set(DCMTK_BUNDLES_LOG4CPLUS 0) |
27dc762e3dc8
getting rid of static dcmtk for debian
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
90
diff
changeset
|
84 endif() |
8 | 85 endif() |
100
27dc762e3dc8
getting rid of static dcmtk for debian
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
90
diff
changeset
|
86 |
103
f2ecbe7d50b8
detection of dcmtk version
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
101
diff
changeset
|
87 add_definitions(-DDCMTK_VERSION_NUMBER=${DCMTK_VERSION_NUMBER}) |
f2ecbe7d50b8
detection of dcmtk version
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
101
diff
changeset
|
88 message("DCMTK version: ${DCMTK_VERSION_NUMBER}") |
101 | 89 message("Does DCMTK includes its own copy of Log4Cplus: ${DCMTK_BUNDLES_LOG4CPLUS}") |