1 # adapted version of FindDCMTK, better suited for super-builds
3 # - find DCMTK libraries and applications
6 # DCMTK_INCLUDE_DIRS - Directories to include to use DCMTK
7 # DCMTK_LIBRARIES - Files to link against to use DCMTK
8 # DCMTK_FOUND - If false, don't try to use DCMTK
9 # DCMTK_DIR - (optional) Source directory for DCMTK
11 # DCMTK_DIR can be used to make it simpler to find the various include
12 # directories and compiled libraries if you've just compiled it in the
13 # source tree. Just set it to the root of the tree where you extracted
14 # the source (default to /usr/include/dcmtk/)
16 #=============================================================================
17 # Copyright 2004-2009 Kitware, Inc.
18 # Copyright 2009-2010 Mathieu Malaterre <mathieu.malaterre@gmail.com>
19 # Copyright 2010 Thomas Sondergaard <ts@medical-insight.com>
21 # Distributed under the OSI-approved BSD License (the "License");
22 # see accompanying file Copyright.txt for details.
24 # This software is distributed WITHOUT ANY WARRANTY; without even the
25 # implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
26 # See the License for more information.
27 #=============================================================================
28 # (To distributed this file outside of CMake, substitute the full
29 # License text for the above reference.)
32 # Written for VXL by Amitha Perera.
33 # Upgraded for GDCM by Mathieu Malaterre.
34 # Modified for EasyViz by Thomas Sondergaard.
37 # prefer DCMTK_DIR over default system paths like /usr/lib
38 set(CMAKE_PREFIX_PATH ${DCMTK_DIR}/lib ${CMAKE_PREFIX_PATH}) #
this is given to FIND_LIBRARY or FIND_PATH
40 if(NOT DCMTK_FOUND AND NOT DCMTK_DIR)
45 "Root of DCMTK source tree (optional).")
46 mark_as_advanced(DCMTK_DIR)
49 # Find all libraries, store debug and release separately
69 # Find Release libraries
70 find_library(DCMTK_${lib}_LIBRARY_RELEASE
73 ${DCMTK_DIR}/${lib}/libsrc
74 ${DCMTK_DIR}/${lib}/libsrc/Release
75 ${DCMTK_DIR}/${lib}/Release
77 ${DCMTK_DIR}/lib/Release
78 ${DCMTK_DIR}/dcmjpeg/lib${lib}/Release
82 # Find
Debug libraries
83 find_library(DCMTK_${lib}_LIBRARY_DEBUG
84 ${lib}${DCMTK_CMAKE_DEBUG_POSTFIX}
86 ${DCMTK_DIR}/${lib}/libsrc
87 ${DCMTK_DIR}/${lib}/libsrc/
Debug
88 ${DCMTK_DIR}/${lib}/
Debug
90 ${DCMTK_DIR}/lib/
Debug
91 ${DCMTK_DIR}/dcmjpeg/lib${lib}/
Debug
95 mark_as_advanced(DCMTK_${lib}_LIBRARY_RELEASE)
96 mark_as_advanced(DCMTK_${lib}_LIBRARY_DEBUG)
98 # Add libraries to variable according to build type
99 set(DCMTK_${lib}_LIBRARY)
100 if(DCMTK_${lib}_LIBRARY_RELEASE)
101 list(APPEND DCMTK_LIBRARIES optimized ${DCMTK_${lib}_LIBRARY_RELEASE})
102 list(APPEND DCMTK_${lib}_LIBRARY optimized ${DCMTK_${lib}_LIBRARY_RELEASE})
105 if(DCMTK_${lib}_LIBRARY_DEBUG)
106 list(APPEND DCMTK_LIBRARIES debug ${DCMTK_${lib}_LIBRARY_DEBUG})
107 list(APPEND DCMTK_${lib}_LIBRARY debug ${DCMTK_${lib}_LIBRARY_DEBUG})
112 set(DCMTK_config_TEST_HEADER osconfig.h)
113 set(DCMTK_dcmdata_TEST_HEADER dctypes.h)
114 set(DCMTK_dcmimage_TEST_HEADER dicoimg.h)
115 set(DCMTK_dcmimgle_TEST_HEADER dcmimage.h)
116 set(DCMTK_dcmjpeg_TEST_HEADER djdecode.h)
117 set(DCMTK_dcmnet_TEST_HEADER assoc.h)
118 set(DCMTK_dcmpstat_TEST_HEADER dcmpstat.h)
119 set(DCMTK_dcmqrdb_TEST_HEADER dcmqrdba.h)
120 set(DCMTK_dcmsign_TEST_HEADER sicert.h)
121 set(DCMTK_dcmsr_TEST_HEADER dsrtree.h)
122 set(DCMTK_dcmtls_TEST_HEADER tlslayer.h)
123 set(DCMTK_ofstd_TEST_HEADER ofstdinc.h)
124 set(DCMTK_dcmrt_TEST_HEADER drtstrct.h)
140 find_path(DCMTK_${dir}_INCLUDE_DIR
141 ${DCMTK_${dir}_TEST_HEADER}
143 ${DCMTK_DIR}/${dir}/include
145 ${DCMTK_DIR}/include/dcmtk/${dir}
146 ${DCMTK_DIR}/include/${dir})
148 mark_as_advanced(DCMTK_${dir}_INCLUDE_DIR)
149 #message(
"** DCMTKs ${dir} found at ${DCMTK_${dir}_INCLUDE_DIR}")
151 if(DCMTK_${dir}_INCLUDE_DIR)
152 # add the
'include' path so eg
153 #include
"dcmtk/dcmimgle/dcmimage.h"
155 get_filename_component(_include ${DCMTK_${dir}_INCLUDE_DIR} PATH)
156 get_filename_component(_include ${_include} PATH)
157 list(APPEND DCMTK_INCLUDE_DIRS ${DCMTK_${dir}_INCLUDE_DIR} ${_include})
162 list(APPEND DCMTK_LIBRARIES netapi32 wsock32)
165 if(DCMTK_ofstd_INCLUDE_DIR)
166 get_filename_component(DCMTK_dcmtk_INCLUDE_DIR
167 ${DCMTK_ofstd_INCLUDE_DIR}
170 list(APPEND DCMTK_INCLUDE_DIRS ${DCMTK_dcmtk_INCLUDE_DIR})
171 mark_as_advanced(DCMTK_dcmtk_INCLUDE_DIR)
174 include(FindPackageHandleStandardArgs)
175 find_package_handle_standard_args(DCMTK DEFAULT_MSG
176 DCMTK_config_INCLUDE_DIR
177 DCMTK_ofstd_INCLUDE_DIR
179 DCMTK_dcmdata_INCLUDE_DIR
180 DCMTK_dcmdata_LIBRARY
181 DCMTK_dcmimgle_INCLUDE_DIR
182 DCMTK_dcmimgle_LIBRARY
185 # Compatibility: This variable is deprecated
186 set(DCMTK_INCLUDE_DIR ${DCMTK_INCLUDE_DIRS})