comparison 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
comparison
equal deleted inserted replaced
102:7593b57dc1bf 103:f2ecbe7d50b8
1 # We always statically link against DCMTK 3.6.0, as there are many 1 # We always statically link against DCMTK 3.6.0, as there are many
2 # differences wrt. DCMTK 3.5.x. 2 # differences wrt. DCMTK 3.5.x.
3 3
4 if (${STATIC_BUILD}) 4 if (${STATIC_BUILD})
5 SET(DCMTK_VERSION_NUMBER 360)
5 SET(DCMTK_SOURCES_DIR ${CMAKE_BINARY_DIR}/dcmtk-3.6.0) 6 SET(DCMTK_SOURCES_DIR ${CMAKE_BINARY_DIR}/dcmtk-3.6.0)
6 DownloadPackage("ftp://dicom.offis.de/pub/dicom/offis/software/dcmtk/dcmtk360/dcmtk-3.6.0.zip" "${DCMTK_SOURCES_DIR}" "" "") 7 DownloadPackage("ftp://dicom.offis.de/pub/dicom/offis/software/dcmtk/dcmtk360/dcmtk-3.6.0.zip" "${DCMTK_SOURCES_DIR}" "" "")
7 8
8 IF(CMAKE_CROSSCOMPILING) 9 IF(CMAKE_CROSSCOMPILING)
9 SET(C_CHAR_UNSIGNED 1 CACHE INTERNAL "Whether char is unsigned.") 10 SET(C_CHAR_UNSIGNED 1 CACHE INTERNAL "Whether char is unsigned.")
37 ${DCMTK_SOURCES_DIR}/dcmdata/libsrc/dcdictbi.cc 38 ${DCMTK_SOURCES_DIR}/dcmdata/libsrc/dcdictbi.cc
38 ) 39 )
39 40
40 # This fixes crashes related to the destruction of the DCMTK OFLogger 41 # This fixes crashes related to the destruction of the DCMTK OFLogger
41 # http://support.dcmtk.org/docs-snapshot/file_macros.html 42 # http://support.dcmtk.org/docs-snapshot/file_macros.html
42 #add_definitions(-DLOG4CPLUS_DISABLE_FATAL=1) 43 add_definitions(
44 -DLOG4CPLUS_DISABLE_FATAL=1
45 -DDCMTK_VERSION_NUMBER=360
46 )
43 47
44 include_directories( 48 include_directories(
45 #${DCMTK_SOURCES_DIR} 49 #${DCMTK_SOURCES_DIR}
46 ${DCMTK_SOURCES_DIR}/config/include 50 ${DCMTK_SOURCES_DIR}/config/include
47 ${DCMTK_SOURCES_DIR}/dcmnet/include 51 ${DCMTK_SOURCES_DIR}/dcmnet/include
62 66
63 add_definitions( 67 add_definitions(
64 -DHAVE_CONFIG_H=1 68 -DHAVE_CONFIG_H=1
65 ) 69 )
66 70
71
72 # Autodetection of the version of DCMTK
73 file(STRINGS "${DCMTK_DIR}/config/cfunix.h" DCMTK_VERSION_NUMBER
74 REGEX ".*PACKAGE_VERSION_NUMBER.*")
75 string(REGEX REPLACE ".*PACKAGE_VERSION_NUMBER" "" DCMTK_VERSION_NUMBER1 ${DCMTK_VERSION_NUMBER})
76 string(STRIP ${DCMTK_VERSION_NUMBER1} DCMTK_VERSION_NUMBER)
77
78
67 IF (EXISTS "${DCMTK_DIR}/oflog") 79 IF (EXISTS "${DCMTK_DIR}/oflog")
68 set(DCMTK_BUNDLES_LOG4CPLUS 1) 80 set(DCMTK_BUNDLES_LOG4CPLUS 1)
69 link_libraries(${DCMTK_LIBRARIES} oflog) 81 link_libraries(${DCMTK_LIBRARIES} oflog)
70 else() 82 else()
71 set(DCMTK_BUNDLES_LOG4CPLUS 0) 83 set(DCMTK_BUNDLES_LOG4CPLUS 0)
72 endif() 84 endif()
73 endif() 85 endif()
74 86
87 add_definitions(-DDCMTK_VERSION_NUMBER=${DCMTK_VERSION_NUMBER})
88 message("DCMTK version: ${DCMTK_VERSION_NUMBER}")
75 message("Does DCMTK includes its own copy of Log4Cplus: ${DCMTK_BUNDLES_LOG4CPLUS}") 89 message("Does DCMTK includes its own copy of Log4Cplus: ${DCMTK_BUNDLES_LOG4CPLUS}")