comparison Resources/CMake/DcmtkConfiguration.cmake @ 287:471df5fecb1e

simplification to cmake for dcmtk
author Sebastien Jodogne <s.jodogne@gmail.com>
date Fri, 14 Dec 2012 10:46:00 +0100
parents 6f4591ba5051
children 4d7469f72a0b
comparison
equal deleted inserted replaced
286:727a6d766dde 287:471df5fecb1e
69 source_group(ThirdParty\\Dcmtk REGULAR_EXPRESSION ${DCMTK_SOURCES_DIR}/.*) 69 source_group(ThirdParty\\Dcmtk REGULAR_EXPRESSION ${DCMTK_SOURCES_DIR}/.*)
70 70
71 set(DCMTK_BUNDLES_LOG4CPLUS 1) 71 set(DCMTK_BUNDLES_LOG4CPLUS 1)
72 72
73 else() 73 else()
74 #include(FindDCMTK) 74 # The following line allows to manually add libraries at the
75 set(DCMTK_DIR /usr/include/dcmtk) 75 # command-line, which is necessary for Ubuntu/Debian packages
76 set(DCMTK_INCLUDE_DIR ${DCMTK_DIR}) 76 set(tmp "${DCMTK_LIBRARIES}")
77 77 include(FindDCMTK)
78 #message(${DCMTK_LIBRARIES}) 78 list(APPEND DCMTK_LIBRARIES "${tmp}")
79 79
80 include_directories(${DCMTK_INCLUDE_DIR}) 80 include_directories(${DCMTK_INCLUDE_DIR})
81 link_libraries(dcmdata dcmnet wrap ofstd) 81 link_libraries(${DCMTK_LIBRARIES})
82 82
83 add_definitions( 83 add_definitions(
84 -DHAVE_CONFIG_H=1 84 -DHAVE_CONFIG_H=1
85 ) 85 )
86 86
91 else() 91 else()
92 message(FATAL_ERROR "Please install libdcmtk1-dev") 92 message(FATAL_ERROR "Please install libdcmtk1-dev")
93 endif() 93 endif()
94 94
95 # Autodetection of the version of DCMTK 95 # Autodetection of the version of DCMTK
96 file(STRINGS "${DCMTK_CONFIGURATION_FILE}" DCMTK_VERSION_NUMBER1 REGEX ".*PACKAGE_VERSION .*") 96 file(STRINGS
97 string(REGEX REPLACE ".*PACKAGE_VERSION.*\"([0-9]*)\\.([0-9]*)\\.([0-9]*)\"$" "\\1\\2\\3" DCMTK_VERSION_NUMBER ${DCMTK_VERSION_NUMBER1}) 97 "${DCMTK_CONFIGURATION_FILE}"
98 DCMTK_VERSION_NUMBER1 REGEX
99 ".*PACKAGE_VERSION .*")
98 100
99 IF (EXISTS "${DCMTK_DIR}/oflog") 101 string(REGEX REPLACE
100 set(DCMTK_BUNDLES_LOG4CPLUS 1) 102 ".*PACKAGE_VERSION.*\"([0-9]*)\\.([0-9]*)\\.([0-9]*)\"$"
101 link_libraries(oflog) 103 "\\1\\2\\3"
102 else() 104 DCMTK_VERSION_NUMBER
103 set(DCMTK_BUNDLES_LOG4CPLUS 0) 105 ${DCMTK_VERSION_NUMBER1})
104 endif()
105 endif() 106 endif()
106 107
107 add_definitions(-DDCMTK_VERSION_NUMBER=${DCMTK_VERSION_NUMBER}) 108 add_definitions(-DDCMTK_VERSION_NUMBER=${DCMTK_VERSION_NUMBER})
108 message("DCMTK version: ${DCMTK_VERSION_NUMBER}") 109 message("DCMTK version: ${DCMTK_VERSION_NUMBER}")
109 message("Does DCMTK includes its own copy of Log4Cplus: ${DCMTK_BUNDLES_LOG4CPLUS}")