diff options
author | Mathieu Malaterre <mathieu.malaterre@gmail.com> | 2010-06-15 07:51:14 (GMT) |
---|---|---|
committer | Mathieu Malaterre <mathieu.malaterre@gmail.com> | 2010-06-15 07:51:14 (GMT) |
commit | b9e227af848f000f9d7ccc3f4dd87b5ee61d8177 (patch) | |
tree | 9e8cb493146c0bb23a3e99bf047032060aa01a25 /Modules/FindDCMTK.cmake | |
parent | d714b18ac5f415e15c5e03bf8f6aaeaf45e143f5 (diff) | |
download | CMake-b9e227af848f000f9d7ccc3f4dd87b5ee61d8177.zip CMake-b9e227af848f000f9d7ccc3f4dd87b5ee61d8177.tar.gz CMake-b9e227af848f000f9d7ccc3f4dd87b5ee61d8177.tar.bz2 |
Cleanup FindDCMTK (using foreach). Fix linking on win32 static libs.
Diffstat (limited to 'Modules/FindDCMTK.cmake')
-rw-r--r-- | Modules/FindDCMTK.cmake | 266 |
1 files changed, 118 insertions, 148 deletions
diff --git a/Modules/FindDCMTK.cmake b/Modules/FindDCMTK.cmake index 2c3fce5..d35433a 100644 --- a/Modules/FindDCMTK.cmake +++ b/Modules/FindDCMTK.cmake @@ -1,7 +1,7 @@ # - 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_FOUND - If false, don't try to use DCMTK # DCMTK_DIR - (optional) Source directory for DCMTK @@ -13,7 +13,8 @@ #============================================================================= # 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"); # see accompanying file Copyright.txt for details. @@ -28,155 +29,124 @@ # # Written for VXL by Amitha Perera. # Upgraded for GDCM by Mathieu Malaterre. -# - -IF( NOT DCMTK_FOUND ) - SET( DCMTK_DIR "/usr/include/dcmtk/" - CACHE PATH "Root of DCMTK source tree (optional)." ) - MARK_AS_ADVANCED( DCMTK_DIR ) -ENDIF( NOT DCMTK_FOUND ) - - -FIND_PATH( DCMTK_config_INCLUDE_DIR osconfig.h - ${DCMTK_DIR}/config/include - ${DCMTK_DIR}/config - ${DCMTK_DIR}/include -) - -FIND_PATH( DCMTK_ofstd_INCLUDE_DIR ofstdinc.h - ${DCMTK_DIR}/ofstd/include - ${DCMTK_DIR}/ofstd - ${DCMTK_DIR}/include/ofstd -) - -FIND_LIBRARY( DCMTK_ofstd_LIBRARY ofstd - ${DCMTK_DIR}/ofstd/libsrc - ${DCMTK_DIR}/ofstd/libsrc/Release - ${DCMTK_DIR}/ofstd/libsrc/Debug - ${DCMTK_DIR}/ofstd/Release - ${DCMTK_DIR}/ofstd/Debug - ${DCMTK_DIR}/lib -) - - -FIND_PATH( DCMTK_dcmdata_INCLUDE_DIR dctypes.h - ${DCMTK_DIR}/include/dcmdata - ${DCMTK_DIR}/dcmdata - ${DCMTK_DIR}/dcmdata/include -) - -FIND_LIBRARY( DCMTK_dcmdata_LIBRARY dcmdata - ${DCMTK_DIR}/dcmdata/libsrc - ${DCMTK_DIR}/dcmdata/libsrc/Release - ${DCMTK_DIR}/dcmdata/libsrc/Debug - ${DCMTK_DIR}/dcmdata/Release - ${DCMTK_DIR}/dcmdata/Debug - ${DCMTK_DIR}/lib -) - - -FIND_PATH( DCMTK_dcmimgle_INCLUDE_DIR dcmimage.h - ${DCMTK_DIR}/dcmimgle/include - ${DCMTK_DIR}/dcmimgle - ${DCMTK_DIR}/include/dcmimgle -) - -FIND_LIBRARY( DCMTK_dcmimgle_LIBRARY dcmimgle - ${DCMTK_DIR}/dcmimgle/libsrc - ${DCMTK_DIR}/dcmimgle/libsrc/Release - ${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 -FIND_LIBRARY(DCMTK_imagedb_LIBRARY imagedb - ${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} +# Modified for EasyViz by Thomas Sondergaard. +# + +if(NOT DCMTK_FOUND AND NOT DCMTK_DIR) + set(DCMTK_DIR + "/usr/include/dcmtk/" + CACHE + PATH + "Root of DCMTK source tree (optional).") + mark_as_advanced(DCMTK_DIR) +endif() + + +foreach(lib + dcmdata + dcmimage + dcmimgle + dcmjpeg + dcmnet + dcmpstat + dcmqrdb + dcmsign + dcmsr + dcmtls + ijg12 + ijg16 + ijg8 + ofstd) + + find_library(DCMTK_${lib}_LIBRARY + ${lib} + PATHS + ${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) + + mark_as_advanced(DCMTK_${lib}_LIBRARY) + + if(DCMTK_${lib}_LIBRARY) + list(APPEND DCMTK_LIBRARIES ${DCMTK_${lib}_LIBRARY}) + endif() + +endforeach() + + +set(DCMTK_config_TEST_HEADER osconfig.h) +set(DCMTK_dcmdata_TEST_HEADER dctypes.h) +set(DCMTK_dcmimage_TEST_HEADER dicoimg.h) +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) + +foreach(dir + config + dcmdata + dcmimage + dcmimgle + dcmjpeg + 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) + + if(DCMTK_${dir}_INCLUDE_DIR) + list(APPEND + DCMTK_INCLUDE_DIRS + ${DCMTK_${dir}_INCLUDE_DIR}) + endif() +endforeach() + +if(WIN32) + list(APPEND DCMTK_LIBRARIES netapi32 wsock32) +endif() + +if(DCMTK_ofstd_INCLUDE_DIR) + get_filename_component(DCMTK_dcmtk_INCLUDE_DIR ${DCMTK_ofstd_INCLUDE_DIR} - ${DCMTK_dcmdata_INCLUDE_DIR} - ${DCMTK_dcmimgle_INCLUDE_DIR} - ) - - SET( DCMTK_LIBRARIES - ${DCMTK_dcmimgle_LIBRARY} - ${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 + PATH + CACHE) + list(APPEND DCMTK_INCLUDE_DIRS ${DCMTK_dcmtk_INCLUDE_DIR}) + mark_as_advanced(DCMTK_dcmtk_INCLUDE_DIR) +endif() + +include(FindPackageHandleStandardArgs) +find_package_handle_standard_args(DCMTK DEFAULT_MSG DCMTK_config_INCLUDE_DIR + DCMTK_ofstd_INCLUDE_DIR + DCMTK_ofstd_LIBRARY DCMTK_dcmdata_INCLUDE_DIR DCMTK_dcmdata_LIBRARY DCMTK_dcmimgle_INCLUDE_DIR - DCMTK_dcmimgle_LIBRARY - DCMTK_imagedb_LIBRARY - DCMTK_dcmnet_LIBRARY - DCMTK_ofstd_INCLUDE_DIR - DCMTK_ofstd_LIBRARY - ) + DCMTK_dcmimgle_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() |