annotate Resources/CMake/DcmtkConfiguration.cmake @ 194:0186ac92810c

fixes for Ubuntu 10.04
author Sebastien Jodogne <s.jodogne@gmail.com>
date Wed, 14 Nov 2012 09:23:53 +0100
parents a1b9d1e1497b
children 6f4591ba5051
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
rev   line source
100
27dc762e3dc8 getting rid of static dcmtk for debian
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 90
diff changeset
1 if (${STATIC_BUILD})
103
f2ecbe7d50b8 detection of dcmtk version
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 101
diff changeset
2 SET(DCMTK_VERSION_NUMBER 360)
8
3a584803783e build with visual studio
jodogne
parents: 0
diff changeset
3 SET(DCMTK_SOURCES_DIR ${CMAKE_BINARY_DIR}/dcmtk-3.6.0)
3a584803783e build with visual studio
jodogne
parents: 0
diff changeset
4 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
5
3a584803783e build with visual studio
jodogne
parents: 0
diff changeset
6 IF(CMAKE_CROSSCOMPILING)
3a584803783e build with visual studio
jodogne
parents: 0
diff changeset
7 SET(C_CHAR_UNSIGNED 1 CACHE INTERNAL "Whether char is unsigned.")
3a584803783e build with visual studio
jodogne
parents: 0
diff changeset
8 ENDIF()
3a584803783e build with visual studio
jodogne
parents: 0
diff changeset
9 SET(DCMTK_SOURCE_DIR ${CMAKE_BINARY_DIR}/dcmtk-3.6.0)
3a584803783e build with visual studio
jodogne
parents: 0
diff changeset
10 include(${DCMTK_SOURCES_DIR}/CMake/CheckFunctionWithHeaderExists.cmake)
3a584803783e build with visual studio
jodogne
parents: 0
diff changeset
11 include(${DCMTK_SOURCES_DIR}/CMake/GenerateDCMTKConfigure.cmake)
193
a1b9d1e1497b failed attempt to compile with linux standard base
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 150
diff changeset
12
a1b9d1e1497b failed attempt to compile with linux standard base
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 150
diff changeset
13 if ("${CMAKE_SYSTEM_VERSION}" STREQUAL "LinuxStandardBase")
a1b9d1e1497b failed attempt to compile with linux standard base
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 150
diff changeset
14 set(HAVE_SSTREAM 1)
a1b9d1e1497b failed attempt to compile with linux standard base
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 150
diff changeset
15 set(HAVE_PROTOTYPE_BZERO 1)
a1b9d1e1497b failed attempt to compile with linux standard base
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 150
diff changeset
16 set(HAVE_PROTOTYPE_GETHOSTNAME 1)
a1b9d1e1497b failed attempt to compile with linux standard base
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 150
diff changeset
17 set(HAVE_PROTOTYPE_GETSOCKOPT 1)
a1b9d1e1497b failed attempt to compile with linux standard base
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 150
diff changeset
18 set(HAVE_PROTOTYPE_SETSOCKOPT 1)
a1b9d1e1497b failed attempt to compile with linux standard base
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 150
diff changeset
19 set(HAVE_PROTOTYPE_CONNECT 1)
a1b9d1e1497b failed attempt to compile with linux standard base
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 150
diff changeset
20 set(HAVE_PROTOTYPE_BIND 1)
a1b9d1e1497b failed attempt to compile with linux standard base
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 150
diff changeset
21 set(HAVE_PROTOTYPE_ACCEPT 1)
a1b9d1e1497b failed attempt to compile with linux standard base
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 150
diff changeset
22 set(HAVE_PROTOTYPE_SETSOCKNAME 1)
a1b9d1e1497b failed attempt to compile with linux standard base
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 150
diff changeset
23 set(HAVE_PROTOTYPE_GETSOCKNAME 1)
a1b9d1e1497b failed attempt to compile with linux standard base
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 150
diff changeset
24 endif()
a1b9d1e1497b failed attempt to compile with linux standard base
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 150
diff changeset
25
a1b9d1e1497b failed attempt to compile with linux standard base
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 150
diff changeset
26 CONFIGURE_FILE(
a1b9d1e1497b failed attempt to compile with linux standard base
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 150
diff changeset
27 ${DCMTK_SOURCES_DIR}/CMake/osconfig.h.in
8
3a584803783e build with visual studio
jodogne
parents: 0
diff changeset
28 ${DCMTK_SOURCES_DIR}/config/include/dcmtk/config/osconfig.h)
3a584803783e build with visual studio
jodogne
parents: 0
diff changeset
29
3a584803783e build with visual studio
jodogne
parents: 0
diff changeset
30 AUX_SOURCE_DIRECTORY(${DCMTK_SOURCES_DIR}/dcmnet/libsrc THIRD_PARTY_SOURCES)
3a584803783e build with visual studio
jodogne
parents: 0
diff changeset
31 AUX_SOURCE_DIRECTORY(${DCMTK_SOURCES_DIR}/dcmdata/libsrc THIRD_PARTY_SOURCES)
3a584803783e build with visual studio
jodogne
parents: 0
diff changeset
32 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
33
27dc762e3dc8 getting rid of static dcmtk for debian
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 90
diff changeset
34 # Source for the logging facility of DCMTK
8
3a584803783e build with visual studio
jodogne
parents: 0
diff changeset
35 AUX_SOURCE_DIRECTORY(${DCMTK_SOURCES_DIR}/oflog/libsrc THIRD_PARTY_SOURCES)
3a584803783e build with visual studio
jodogne
parents: 0
diff changeset
36 if (${CMAKE_SYSTEM_NAME} STREQUAL "Linux")
3a584803783e build with visual studio
jodogne
parents: 0
diff changeset
37 list(REMOVE_ITEM THIRD_PARTY_SOURCES
3a584803783e build with visual studio
jodogne
parents: 0
diff changeset
38 ${DCMTK_SOURCES_DIR}/oflog/libsrc/windebap.cc
3a584803783e build with visual studio
jodogne
parents: 0
diff changeset
39 ${DCMTK_SOURCES_DIR}/oflog/libsrc/winsock.cc
3a584803783e build with visual studio
jodogne
parents: 0
diff changeset
40 )
3a584803783e build with visual studio
jodogne
parents: 0
diff changeset
41 elseif (${CMAKE_SYSTEM_NAME} STREQUAL "Windows")
3a584803783e build with visual studio
jodogne
parents: 0
diff changeset
42 list(REMOVE_ITEM THIRD_PARTY_SOURCES
3a584803783e build with visual studio
jodogne
parents: 0
diff changeset
43 ${DCMTK_SOURCES_DIR}/oflog/libsrc/unixsock.cc
3a584803783e build with visual studio
jodogne
parents: 0
diff changeset
44 )
3a584803783e build with visual studio
jodogne
parents: 0
diff changeset
45 endif()
3a584803783e build with visual studio
jodogne
parents: 0
diff changeset
46
3a584803783e build with visual studio
jodogne
parents: 0
diff changeset
47 list(REMOVE_ITEM THIRD_PARTY_SOURCES
3a584803783e build with visual studio
jodogne
parents: 0
diff changeset
48 ${DCMTK_SOURCES_DIR}/dcmdata/libsrc/mkdictbi.cc
3a584803783e build with visual studio
jodogne
parents: 0
diff changeset
49 ${DCMTK_SOURCES_DIR}/dcmdata/libsrc/mkdeftag.cc
3a584803783e build with visual studio
jodogne
parents: 0
diff changeset
50 ${DCMTK_SOURCES_DIR}/dcmdata/libsrc/dcdictbi.cc
3a584803783e build with visual studio
jodogne
parents: 0
diff changeset
51 )
3a584803783e build with visual studio
jodogne
parents: 0
diff changeset
52
3a584803783e build with visual studio
jodogne
parents: 0
diff changeset
53 # This fixes crashes related to the destruction of the DCMTK OFLogger
3a584803783e build with visual studio
jodogne
parents: 0
diff changeset
54 # 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
55 add_definitions(
f2ecbe7d50b8 detection of dcmtk version
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 101
diff changeset
56 -DLOG4CPLUS_DISABLE_FATAL=1
f2ecbe7d50b8 detection of dcmtk version
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 101
diff changeset
57 -DDCMTK_VERSION_NUMBER=360
f2ecbe7d50b8 detection of dcmtk version
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 101
diff changeset
58 )
8
3a584803783e build with visual studio
jodogne
parents: 0
diff changeset
59
3a584803783e build with visual studio
jodogne
parents: 0
diff changeset
60 include_directories(
3a584803783e build with visual studio
jodogne
parents: 0
diff changeset
61 #${DCMTK_SOURCES_DIR}
3a584803783e build with visual studio
jodogne
parents: 0
diff changeset
62 ${DCMTK_SOURCES_DIR}/config/include
3a584803783e build with visual studio
jodogne
parents: 0
diff changeset
63 ${DCMTK_SOURCES_DIR}/dcmnet/include
3a584803783e build with visual studio
jodogne
parents: 0
diff changeset
64 ${DCMTK_SOURCES_DIR}/ofstd/include
3a584803783e build with visual studio
jodogne
parents: 0
diff changeset
65 ${DCMTK_SOURCES_DIR}/oflog/include
3a584803783e build with visual studio
jodogne
parents: 0
diff changeset
66 ${DCMTK_SOURCES_DIR}/dcmdata/include
3a584803783e build with visual studio
jodogne
parents: 0
diff changeset
67 )
3a584803783e build with visual studio
jodogne
parents: 0
diff changeset
68
3a584803783e build with visual studio
jodogne
parents: 0
diff changeset
69 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
70
27dc762e3dc8 getting rid of static dcmtk for debian
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 90
diff changeset
71 set(DCMTK_BUNDLES_LOG4CPLUS 1)
27dc762e3dc8 getting rid of static dcmtk for debian
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 90
diff changeset
72
8
3a584803783e build with visual studio
jodogne
parents: 0
diff changeset
73 else()
116
5dce26a8d045 skip autodetection of dcmtk by cmake
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 115
diff changeset
74 #include(FindDCMTK)
5dce26a8d045 skip autodetection of dcmtk by cmake
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 115
diff changeset
75 set(DCMTK_DIR /usr/include/dcmtk)
5dce26a8d045 skip autodetection of dcmtk by cmake
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 115
diff changeset
76 set(DCMTK_INCLUDE_DIR ${DCMTK_DIR})
8
3a584803783e build with visual studio
jodogne
parents: 0
diff changeset
77
115
97d92e25c961 improvements
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 114
diff changeset
78 #message(${DCMTK_LIBRARIES})
97d92e25c961 improvements
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 114
diff changeset
79
8
3a584803783e build with visual studio
jodogne
parents: 0
diff changeset
80 include_directories(${DCMTK_INCLUDE_DIR})
117
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 116
diff changeset
81 link_libraries(dcmdata dcmnet wrap ofstd)
8
3a584803783e build with visual studio
jodogne
parents: 0
diff changeset
82
3a584803783e build with visual studio
jodogne
parents: 0
diff changeset
83 add_definitions(
3a584803783e build with visual studio
jodogne
parents: 0
diff changeset
84 -DHAVE_CONFIG_H=1
3a584803783e build with visual studio
jodogne
parents: 0
diff changeset
85 )
100
27dc762e3dc8 getting rid of static dcmtk for debian
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 90
diff changeset
86
150
1058c115aed1 patch for archlinux
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 117
diff changeset
87 if (EXISTS "${DCMTK_DIR}/config/cfunix.h")
1058c115aed1 patch for archlinux
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 117
diff changeset
88 set(DCMTK_CONFIGURATION_FILE "${DCMTK_DIR}/config/cfunix.h")
1058c115aed1 patch for archlinux
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 117
diff changeset
89 elseif (EXISTS "${DCMTK_DIR}/config/osconfig.h") # This is for Arch Linux
1058c115aed1 patch for archlinux
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 117
diff changeset
90 set(DCMTK_CONFIGURATION_FILE "${DCMTK_DIR}/config/osconfig.h")
1058c115aed1 patch for archlinux
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 117
diff changeset
91 else()
109
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 104
diff changeset
92 message(FATAL_ERROR "Please install libdcmtk1-dev")
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 104
diff changeset
93 endif()
103
f2ecbe7d50b8 detection of dcmtk version
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 101
diff changeset
94
f2ecbe7d50b8 detection of dcmtk version
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 101
diff changeset
95 # Autodetection of the version of DCMTK
150
1058c115aed1 patch for archlinux
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 117
diff changeset
96 file(STRINGS "${DCMTK_CONFIGURATION_FILE}" DCMTK_VERSION_NUMBER1 REGEX ".*PACKAGE_VERSION .*")
104
jodogne
parents: 103
diff changeset
97 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
98
100
27dc762e3dc8 getting rid of static dcmtk for debian
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 90
diff changeset
99 IF (EXISTS "${DCMTK_DIR}/oflog")
27dc762e3dc8 getting rid of static dcmtk for debian
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 90
diff changeset
100 set(DCMTK_BUNDLES_LOG4CPLUS 1)
117
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 116
diff changeset
101 link_libraries(oflog)
100
27dc762e3dc8 getting rid of static dcmtk for debian
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 90
diff changeset
102 else()
27dc762e3dc8 getting rid of static dcmtk for debian
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 90
diff changeset
103 set(DCMTK_BUNDLES_LOG4CPLUS 0)
27dc762e3dc8 getting rid of static dcmtk for debian
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 90
diff changeset
104 endif()
8
3a584803783e build with visual studio
jodogne
parents: 0
diff changeset
105 endif()
100
27dc762e3dc8 getting rid of static dcmtk for debian
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 90
diff changeset
106
103
f2ecbe7d50b8 detection of dcmtk version
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 101
diff changeset
107 add_definitions(-DDCMTK_VERSION_NUMBER=${DCMTK_VERSION_NUMBER})
f2ecbe7d50b8 detection of dcmtk version
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 101
diff changeset
108 message("DCMTK version: ${DCMTK_VERSION_NUMBER}")
101
428784e59dcd trying to use log4cplus
jodogne
parents: 100
diff changeset
109 message("Does DCMTK includes its own copy of Log4Cplus: ${DCMTK_BUNDLES_LOG4CPLUS}")