annotate Resources/CMake/DcmtkConfiguration.cmake @ 114:b4f1191768eb

fix
author Sebastien Jodogne <s.jodogne@gmail.com>
date Thu, 04 Oct 2012 14:35:53 +0200
parents 8c0a5666b05f
children 97d92e25c961
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
rev   line source
90
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 8
diff changeset
1 # We always statically link against DCMTK 3.6.0, as there are many
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 8
diff changeset
2 # differences wrt. DCMTK 3.5.x.
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 8
diff changeset
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
3a584803783e build with visual studio
jodogne
parents: 0
diff changeset
6 SET(DCMTK_SOURCES_DIR ${CMAKE_BINARY_DIR}/dcmtk-3.6.0)
3a584803783e build with visual studio
jodogne
parents: 0
diff changeset
7 DownloadPackage("ftp://dicom.offis.de/pub/dicom/offis/software/dcmtk/dcmtk360/dcmtk-3.6.0.zip" "${DCMTK_SOURCES_DIR}" "" "")
3a584803783e build with visual studio
jodogne
parents: 0
diff changeset
8
3a584803783e build with visual studio
jodogne
parents: 0
diff changeset
9 IF(CMAKE_CROSSCOMPILING)
3a584803783e build with visual studio
jodogne
parents: 0
diff changeset
10 SET(C_CHAR_UNSIGNED 1 CACHE INTERNAL "Whether char is unsigned.")
3a584803783e build with visual studio
jodogne
parents: 0
diff changeset
11 ENDIF()
3a584803783e build with visual studio
jodogne
parents: 0
diff changeset
12 SET(DCMTK_SOURCE_DIR ${CMAKE_BINARY_DIR}/dcmtk-3.6.0)
3a584803783e build with visual studio
jodogne
parents: 0
diff changeset
13 include(${DCMTK_SOURCES_DIR}/CMake/CheckFunctionWithHeaderExists.cmake)
3a584803783e build with visual studio
jodogne
parents: 0
diff changeset
14 include(${DCMTK_SOURCES_DIR}/CMake/GenerateDCMTKConfigure.cmake)
3a584803783e build with visual studio
jodogne
parents: 0
diff changeset
15 CONFIGURE_FILE(${DCMTK_SOURCES_DIR}/CMake/osconfig.h.in
3a584803783e build with visual studio
jodogne
parents: 0
diff changeset
16 ${DCMTK_SOURCES_DIR}/config/include/dcmtk/config/osconfig.h)
3a584803783e build with visual studio
jodogne
parents: 0
diff changeset
17
3a584803783e build with visual studio
jodogne
parents: 0
diff changeset
18 AUX_SOURCE_DIRECTORY(${DCMTK_SOURCES_DIR}/dcmnet/libsrc THIRD_PARTY_SOURCES)
3a584803783e build with visual studio
jodogne
parents: 0
diff changeset
19 AUX_SOURCE_DIRECTORY(${DCMTK_SOURCES_DIR}/dcmdata/libsrc THIRD_PARTY_SOURCES)
3a584803783e build with visual studio
jodogne
parents: 0
diff changeset
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
3a584803783e build with visual studio
jodogne
parents: 0
diff changeset
23 AUX_SOURCE_DIRECTORY(${DCMTK_SOURCES_DIR}/oflog/libsrc THIRD_PARTY_SOURCES)
3a584803783e build with visual studio
jodogne
parents: 0
diff changeset
24 if (${CMAKE_SYSTEM_NAME} STREQUAL "Linux")
3a584803783e build with visual studio
jodogne
parents: 0
diff changeset
25 list(REMOVE_ITEM THIRD_PARTY_SOURCES
3a584803783e build with visual studio
jodogne
parents: 0
diff changeset
26 ${DCMTK_SOURCES_DIR}/oflog/libsrc/windebap.cc
3a584803783e build with visual studio
jodogne
parents: 0
diff changeset
27 ${DCMTK_SOURCES_DIR}/oflog/libsrc/winsock.cc
3a584803783e build with visual studio
jodogne
parents: 0
diff changeset
28 )
3a584803783e build with visual studio
jodogne
parents: 0
diff changeset
29 elseif (${CMAKE_SYSTEM_NAME} STREQUAL "Windows")
3a584803783e build with visual studio
jodogne
parents: 0
diff changeset
30 list(REMOVE_ITEM THIRD_PARTY_SOURCES
3a584803783e build with visual studio
jodogne
parents: 0
diff changeset
31 ${DCMTK_SOURCES_DIR}/oflog/libsrc/unixsock.cc
3a584803783e build with visual studio
jodogne
parents: 0
diff changeset
32 )
3a584803783e build with visual studio
jodogne
parents: 0
diff changeset
33 endif()
3a584803783e build with visual studio
jodogne
parents: 0
diff changeset
34
3a584803783e build with visual studio
jodogne
parents: 0
diff changeset
35 list(REMOVE_ITEM THIRD_PARTY_SOURCES
3a584803783e build with visual studio
jodogne
parents: 0
diff changeset
36 ${DCMTK_SOURCES_DIR}/dcmdata/libsrc/mkdictbi.cc
3a584803783e build with visual studio
jodogne
parents: 0
diff changeset
37 ${DCMTK_SOURCES_DIR}/dcmdata/libsrc/mkdeftag.cc
3a584803783e build with visual studio
jodogne
parents: 0
diff changeset
38 ${DCMTK_SOURCES_DIR}/dcmdata/libsrc/dcdictbi.cc
3a584803783e build with visual studio
jodogne
parents: 0
diff changeset
39 )
3a584803783e build with visual studio
jodogne
parents: 0
diff changeset
40
3a584803783e build with visual studio
jodogne
parents: 0
diff changeset
41 # This fixes crashes related to the destruction of the DCMTK OFLogger
3a584803783e build with visual studio
jodogne
parents: 0
diff changeset
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
3a584803783e build with visual studio
jodogne
parents: 0
diff changeset
47
3a584803783e build with visual studio
jodogne
parents: 0
diff changeset
48 include_directories(
3a584803783e build with visual studio
jodogne
parents: 0
diff changeset
49 #${DCMTK_SOURCES_DIR}
3a584803783e build with visual studio
jodogne
parents: 0
diff changeset
50 ${DCMTK_SOURCES_DIR}/config/include
3a584803783e build with visual studio
jodogne
parents: 0
diff changeset
51 ${DCMTK_SOURCES_DIR}/dcmnet/include
3a584803783e build with visual studio
jodogne
parents: 0
diff changeset
52 ${DCMTK_SOURCES_DIR}/ofstd/include
3a584803783e build with visual studio
jodogne
parents: 0
diff changeset
53 ${DCMTK_SOURCES_DIR}/oflog/include
3a584803783e build with visual studio
jodogne
parents: 0
diff changeset
54 ${DCMTK_SOURCES_DIR}/dcmdata/include
3a584803783e build with visual studio
jodogne
parents: 0
diff changeset
55 )
3a584803783e build with visual studio
jodogne
parents: 0
diff changeset
56
3a584803783e build with visual studio
jodogne
parents: 0
diff changeset
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
3a584803783e build with visual studio
jodogne
parents: 0
diff changeset
61 else()
3a584803783e build with visual studio
jodogne
parents: 0
diff changeset
62 include(FindDCMTK)
3a584803783e build with visual studio
jodogne
parents: 0
diff changeset
63
3a584803783e build with visual studio
jodogne
parents: 0
diff changeset
64 include_directories(${DCMTK_INCLUDE_DIR})
114
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 109
diff changeset
65 link_libraries(${DCMTK_LIBRARIES} ofstd)
8
3a584803783e build with visual studio
jodogne
parents: 0
diff changeset
66
3a584803783e build with visual studio
jodogne
parents: 0
diff changeset
67 add_definitions(
3a584803783e build with visual studio
jodogne
parents: 0
diff changeset
68 -DHAVE_CONFIG_H=1
3a584803783e build with visual studio
jodogne
parents: 0
diff changeset
69 )
100
27dc762e3dc8 getting rid of static dcmtk for debian
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 90
diff changeset
70
109
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 104
diff changeset
71 if (NOT EXISTS "${DCMTK_DIR}/config/cfunix.h")
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 104
diff changeset
72 message(FATAL_ERROR "Please install libdcmtk1-dev")
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 104
diff changeset
73 endif()
103
f2ecbe7d50b8 detection of dcmtk version
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 101
diff changeset
74
f2ecbe7d50b8 detection of dcmtk version
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 101
diff changeset
75 # Autodetection of the version of DCMTK
104
jodogne
parents: 103
diff changeset
76 file(STRINGS "${DCMTK_DIR}/config/cfunix.h" DCMTK_VERSION_NUMBER1
jodogne
parents: 103
diff changeset
77 REGEX ".*PACKAGE_VERSION .*")
jodogne
parents: 103
diff changeset
78 string(REGEX REPLACE ".*PACKAGE_VERSION.*\"([0-9]*)\\.([0-9]*)\\.([0-9]*)\"$" "\\1\\2\\3" DCMTK_VERSION_NUMBER ${DCMTK_VERSION_NUMBER1})
103
f2ecbe7d50b8 detection of dcmtk version
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 101
diff changeset
79
f2ecbe7d50b8 detection of dcmtk version
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 101
diff changeset
80
100
27dc762e3dc8 getting rid of static dcmtk for debian
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 90
diff changeset
81 IF (EXISTS "${DCMTK_DIR}/oflog")
27dc762e3dc8 getting rid of static dcmtk for debian
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 90
diff changeset
82 set(DCMTK_BUNDLES_LOG4CPLUS 1)
114
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 109
diff changeset
83 link_libraries(${DCMTK_LIBRARIES} oflog wrap)
100
27dc762e3dc8 getting rid of static dcmtk for debian
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 90
diff changeset
84 else()
27dc762e3dc8 getting rid of static dcmtk for debian
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 90
diff changeset
85 set(DCMTK_BUNDLES_LOG4CPLUS 0)
27dc762e3dc8 getting rid of static dcmtk for debian
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 90
diff changeset
86 endif()
8
3a584803783e build with visual studio
jodogne
parents: 0
diff changeset
87 endif()
100
27dc762e3dc8 getting rid of static dcmtk for debian
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 90
diff changeset
88
103
f2ecbe7d50b8 detection of dcmtk version
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 101
diff changeset
89 add_definitions(-DDCMTK_VERSION_NUMBER=${DCMTK_VERSION_NUMBER})
f2ecbe7d50b8 detection of dcmtk version
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 101
diff changeset
90 message("DCMTK version: ${DCMTK_VERSION_NUMBER}")
101
428784e59dcd trying to use log4cplus
jodogne
parents: 100
diff changeset
91 message("Does DCMTK includes its own copy of Log4Cplus: ${DCMTK_BUNDLES_LOG4CPLUS}")