Merge branch 'finddcmtk'

This commit is contained in:
Brad King 2010-06-22 10:03:29 -04:00
commit d39ffaa261

View File

@ -1,7 +1,7 @@
# - find DCMTK libraries and applications # - find DCMTK libraries and applications
# #
# DCMTK_INCLUDE_DIR - Directories to include to use DCMTK # DCMTK_INCLUDE_DIRS - Directories to include to use DCMTK
# DCMTK_LIBRARIES - Files to link against to use DCMTK # DCMTK_LIBRARIES - Files to link against to use DCMTK
# DCMTK_FOUND - If false, don't try to use DCMTK # DCMTK_FOUND - If false, don't try to use DCMTK
# DCMTK_DIR - (optional) Source directory for DCMTK # DCMTK_DIR - (optional) Source directory for DCMTK
@ -13,7 +13,8 @@
#============================================================================= #=============================================================================
# Copyright 2004-2009 Kitware, Inc. # Copyright 2004-2009 Kitware, Inc.
# Copyright 2009 Mathieu Malaterre <mathieu.malaterre@gmail.com> # Copyright 2009-2010 Mathieu Malaterre <mathieu.malaterre@gmail.com>
# Copyright 2010 Thomas Sondergaard <ts@medical-insight.com>
# #
# Distributed under the OSI-approved BSD License (the "License"); # Distributed under the OSI-approved BSD License (the "License");
# see accompanying file Copyright.txt for details. # see accompanying file Copyright.txt for details.
@ -28,155 +29,124 @@
# #
# Written for VXL by Amitha Perera. # Written for VXL by Amitha Perera.
# Upgraded for GDCM by Mathieu Malaterre. # Upgraded for GDCM by Mathieu Malaterre.
# # Modified for EasyViz by Thomas Sondergaard.
#
IF( NOT DCMTK_FOUND ) if(NOT DCMTK_FOUND AND NOT DCMTK_DIR)
SET( DCMTK_DIR "/usr/include/dcmtk/" set(DCMTK_DIR
CACHE PATH "Root of DCMTK source tree (optional)." ) "/usr/include/dcmtk/"
MARK_AS_ADVANCED( DCMTK_DIR ) CACHE
ENDIF( NOT DCMTK_FOUND ) PATH
"Root of DCMTK source tree (optional).")
mark_as_advanced(DCMTK_DIR)
endif()
FIND_PATH( DCMTK_config_INCLUDE_DIR osconfig.h foreach(lib
${DCMTK_DIR}/config/include dcmdata
${DCMTK_DIR}/config dcmimage
${DCMTK_DIR}/include dcmimgle
) dcmjpeg
dcmnet
dcmpstat
dcmqrdb
dcmsign
dcmsr
dcmtls
ijg12
ijg16
ijg8
ofstd)
FIND_PATH( DCMTK_ofstd_INCLUDE_DIR ofstdinc.h find_library(DCMTK_${lib}_LIBRARY
${DCMTK_DIR}/ofstd/include ${lib}
${DCMTK_DIR}/ofstd PATHS
${DCMTK_DIR}/include/ofstd ${DCMTK_DIR}/${lib}/libsrc
) ${DCMTK_DIR}/${lib}/libsrc/Release
${DCMTK_DIR}/${lib}/libsrc/Debug
${DCMTK_DIR}/${lib}/Release
${DCMTK_DIR}/${lib}/Debug
${DCMTK_DIR}/lib)
FIND_LIBRARY( DCMTK_ofstd_LIBRARY ofstd mark_as_advanced(DCMTK_${lib}_LIBRARY)
${DCMTK_DIR}/ofstd/libsrc
${DCMTK_DIR}/ofstd/libsrc/Release if(DCMTK_${lib}_LIBRARY)
${DCMTK_DIR}/ofstd/libsrc/Debug list(APPEND DCMTK_LIBRARIES ${DCMTK_${lib}_LIBRARY})
${DCMTK_DIR}/ofstd/Release endif()
${DCMTK_DIR}/ofstd/Debug
${DCMTK_DIR}/lib endforeach()
)
FIND_PATH( DCMTK_dcmdata_INCLUDE_DIR dctypes.h set(DCMTK_config_TEST_HEADER osconfig.h)
${DCMTK_DIR}/include/dcmdata set(DCMTK_dcmdata_TEST_HEADER dctypes.h)
${DCMTK_DIR}/dcmdata set(DCMTK_dcmimage_TEST_HEADER dicoimg.h)
${DCMTK_DIR}/dcmdata/include set(DCMTK_dcmimgle_TEST_HEADER dcmimage.h)
) set(DCMTK_dcmjpeg_TEST_HEADER djdecode.h)
set(DCMTK_dcmnet_TEST_HEADER assoc.h)
set(DCMTK_dcmpstat_TEST_HEADER dcmpstat.h)
set(DCMTK_dcmqrdb_TEST_HEADER dcmqrdba.h)
set(DCMTK_dcmsign_TEST_HEADER sicert.h)
set(DCMTK_dcmsr_TEST_HEADER dsrtree.h)
set(DCMTK_dcmtls_TEST_HEADER tlslayer.h)
set(DCMTK_ofstd_TEST_HEADER ofstdinc.h)
FIND_LIBRARY( DCMTK_dcmdata_LIBRARY dcmdata foreach(dir
${DCMTK_DIR}/dcmdata/libsrc config
${DCMTK_DIR}/dcmdata/libsrc/Release dcmdata
${DCMTK_DIR}/dcmdata/libsrc/Debug dcmimage
${DCMTK_DIR}/dcmdata/Release dcmimgle
${DCMTK_DIR}/dcmdata/Debug dcmjpeg
${DCMTK_DIR}/lib dcmnet
) dcmpstat
dcmqrdb
dcmsign
dcmsr
dcmtls
ofstd)
find_path(DCMTK_${dir}_INCLUDE_DIR
${DCMTK_${dir}_TEST_HEADER}
PATHS
${DCMTK_DIR}/${dir}/include
${DCMTK_DIR}/${dir}
${DCMTK_DIR}/include/${dir})
mark_as_advanced(DCMTK_${dir}_INCLUDE_DIR)
FIND_PATH( DCMTK_dcmimgle_INCLUDE_DIR dcmimage.h if(DCMTK_${dir}_INCLUDE_DIR)
${DCMTK_DIR}/dcmimgle/include list(APPEND
${DCMTK_DIR}/dcmimgle DCMTK_INCLUDE_DIRS
${DCMTK_DIR}/include/dcmimgle ${DCMTK_${dir}_INCLUDE_DIR})
) endif()
endforeach()
FIND_LIBRARY( DCMTK_dcmimgle_LIBRARY dcmimgle if(WIN32)
${DCMTK_DIR}/dcmimgle/libsrc list(APPEND DCMTK_LIBRARIES netapi32 wsock32)
${DCMTK_DIR}/dcmimgle/libsrc/Release endif()
${DCMTK_DIR}/dcmimgle/libsrc/Debug
${DCMTK_DIR}/dcmimgle/Release
${DCMTK_DIR}/dcmimgle/Debug
${DCMTK_DIR}/lib
)
# MM: I could not find this library on debian system / dcmtk 3.5.4 if(DCMTK_ofstd_INCLUDE_DIR)
FIND_LIBRARY(DCMTK_imagedb_LIBRARY imagedb get_filename_component(DCMTK_dcmtk_INCLUDE_DIR
${DCMTK_DIR}/imagectn/libsrc/Release
${DCMTK_DIR}/imagectn/libsrc/
${DCMTK_DIR}/imagectn/libsrc/Debug
)
FIND_LIBRARY(DCMTK_dcmnet_LIBRARY dcmnet
${DCMTK_DIR}/dcmnet/libsrc/Release
${DCMTK_DIR}/dcmnet/libsrc/Debug
${DCMTK_DIR}/dcmnet/libsrc/
)
IF( DCMTK_config_INCLUDE_DIR
AND DCMTK_ofstd_INCLUDE_DIR
AND DCMTK_ofstd_LIBRARY
AND DCMTK_dcmdata_INCLUDE_DIR
AND DCMTK_dcmdata_LIBRARY
AND DCMTK_dcmimgle_INCLUDE_DIR
AND DCMTK_dcmimgle_LIBRARY )
SET( DCMTK_FOUND "YES" )
SET( DCMTK_INCLUDE_DIR
${DCMTK_config_INCLUDE_DIR}
${DCMTK_ofstd_INCLUDE_DIR} ${DCMTK_ofstd_INCLUDE_DIR}
${DCMTK_dcmdata_INCLUDE_DIR} PATH
${DCMTK_dcmimgle_INCLUDE_DIR} CACHE)
) list(APPEND DCMTK_INCLUDE_DIRS ${DCMTK_dcmtk_INCLUDE_DIR})
mark_as_advanced(DCMTK_dcmtk_INCLUDE_DIR)
endif()
SET( DCMTK_LIBRARIES include(FindPackageHandleStandardArgs)
${DCMTK_dcmimgle_LIBRARY} find_package_handle_standard_args(DCMTK DEFAULT_MSG
${DCMTK_dcmdata_LIBRARY}
${DCMTK_ofstd_LIBRARY}
${DCMTK_config_LIBRARY}
)
IF(DCMTK_imagedb_LIBRARY)
SET( DCMTK_LIBRARIES
${DCMTK_LIBRARIES}
${DCMTK_imagedb_LIBRARY}
)
ENDIF(DCMTK_imagedb_LIBRARY)
IF(DCMTK_dcmnet_LIBRARY)
SET( DCMTK_LIBRARIES
${DCMTK_LIBRARIES}
${DCMTK_dcmnet_LIBRARY}
)
ENDIF(DCMTK_dcmnet_LIBRARY)
IF( WIN32 )
SET( DCMTK_LIBRARIES ${DCMTK_LIBRARIES} netapi32 )
ENDIF( WIN32 )
ENDIF( DCMTK_config_INCLUDE_DIR
AND DCMTK_ofstd_INCLUDE_DIR
AND DCMTK_ofstd_LIBRARY
AND DCMTK_dcmdata_INCLUDE_DIR
AND DCMTK_dcmdata_LIBRARY
AND DCMTK_dcmimgle_INCLUDE_DIR
AND DCMTK_dcmimgle_LIBRARY )
FIND_PROGRAM(DCMTK_DCMDUMP_EXECUTABLE dcmdump
${DCMTK_DIR}/bin
)
FIND_PROGRAM(DCMTK_DCMDJPEG_EXECUTABLE dcmdjpeg
${DCMTK_DIR}/bin
)
FIND_PROGRAM(DCMTK_DCMDRLE_EXECUTABLE dcmdrle
${DCMTK_DIR}/bin
)
MARK_AS_ADVANCED(
DCMTK_DCMDUMP_EXECUTABLE
DCMTK_DCMDJPEG_EXECUTABLE
DCMTK_DCMDRLE_EXECUTABLE
DCMTK_config_INCLUDE_DIR DCMTK_config_INCLUDE_DIR
DCMTK_ofstd_INCLUDE_DIR
DCMTK_ofstd_LIBRARY
DCMTK_dcmdata_INCLUDE_DIR DCMTK_dcmdata_INCLUDE_DIR
DCMTK_dcmdata_LIBRARY DCMTK_dcmdata_LIBRARY
DCMTK_dcmimgle_INCLUDE_DIR DCMTK_dcmimgle_INCLUDE_DIR
DCMTK_dcmimgle_LIBRARY DCMTK_dcmimgle_LIBRARY)
DCMTK_imagedb_LIBRARY
DCMTK_dcmnet_LIBRARY
DCMTK_ofstd_INCLUDE_DIR
DCMTK_ofstd_LIBRARY
)
# Compatibility: This variable is deprecated
set(DCMTK_INCLUDE_DIR ${DCMTK_INCLUDE_DIRS})
foreach(executable dcmdump dcmdjpeg dcmdrle)
string(TOUPPER ${executable} EXECUTABLE)
find_program(DCMTK_${EXECUTABLE}_EXECUTABLE ${executable} ${DCMTK_DIR}/bin)
mark_as_advanced(DCMTK_${EXECUTABLE}_EXECUTABLE)
endforeach()