From 31b4700ed640bee962f9db9ce25fa84261a944d2 Mon Sep 17 00:00:00 2001 From: Jean-Christophe Fillion-Robin Date: Mon, 11 Jan 2016 16:08:56 -0500 Subject: [PATCH 1/6] FindDCMTK: Improve compatibility with DCMTKConfig.cmake. This improvement to the FindDCMTK module improves compatibility with recent DCMTK, which provides a DCMTKConfig.cmake file. See the module comments for a compatibility matrix. It also provides DCMTK_INCLUDE_DIRS. Ported from CommonTK (commontk.org). --- Modules/FindDCMTK.cmake | 286 +++++++++++++++++++++++++++++++++------- 1 file changed, 240 insertions(+), 46 deletions(-) diff --git a/Modules/FindDCMTK.cmake b/Modules/FindDCMTK.cmake index 91aafbbd0..56939720a 100644 --- a/Modules/FindDCMTK.cmake +++ b/Modules/FindDCMTK.cmake @@ -2,9 +2,10 @@ # FindDCMTK # --------- # -# find DCMTK libraries and applications - -# DCMTK_INCLUDE_DIRS - Directories to include to use DCMTK +# - find DCMTK libraries and applications +# The module defines the following variables: +# +# 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 @@ -12,8 +13,91 @@ # DCMTK_DIR can be used to make it simpler to find the various include # directories and compiled libraries if you've just compiled it in the # source tree. Just set it to the root of the tree where you extracted -# the source (default to /usr/include/dcmtk/) - +# the source (default to /usr) +# +# +# This file is able to find version of DCMTK that do or do not export +# a DCMTKConfig.cmake file. +# +# IMPORTANT: A set of patches has been contributed to DCMTK +# maintainers, as soon as: +# (1) it has been integrated upstream so that it is available in +# an official release (for example X.Y.Z), +# (2) code bases have been updated to build against X.Y.Z +# This file could be removed. +# +# The set of patches is listed here: https://github.com/commontk/DCMTK/compare/79030ba...f461865 +# +# +# Waiting for this to happen, build systems will have to be able +# to support different versions of DCMTK. +# +# On any given system, the following combination of DCMTK version could be +# considered: +# +# | SYSTEM DCMTK + LOCAL DCMTK | Supported ? | +# --------------------------------------------------------------------------- +# Case A | NA + [ ] DCMTKConfig | YES | +# ------------------------------------------------------|-------------------- +# Case B | NA + [X] DCMTKConfig | YES | +# ------------------------------------------------------|-------------------- +# Case C | [ ] DCMTKConfig + NA | YES | +# ------------------------------------------------------|-------------------- +# Case D | [X] DCMTKConfig + NA | YES | +# ------------------------------------------------------|-------------------- +# Case E | [ ] DCMTKConfig + [ ] DCMTKConfig | YES (*) | +# ------------------------------------------------------|-------------------- +# Case F | [X] DCMTKConfig + [ ] DCMTKConfig | NO | +# ------------------------------------------------------|-------------------- +# Case G | [ ] DCMTKConfig + [X] DCMTKConfig | YES | +# ------------------------------------------------------|-------------------- +# Case H | [X] DCMTKConfig + [X] DCMTKConfig | YES | +# --------------------------------------------------------------------------- +# +# (*) See Troubleshooting section. +# +# Legend: +# +# NA ...............: Means that no System or Local DCMTK is available +# +# [ ] DCMTKConfig ..: Means that the version of DCMTK does NOT export a DCMTKConfig.cmake file. +# +# [X] DCMTKConfig ..: Means that the version of DCMTK exports a DCMTKConfig.cmake file. +# +# +# +# In CTK commits 52d953 and 74b4b07, the FindDCMTK.cmake module has been updated to be able +# to find both version of DCMTK ([ ] DCMTKConfig and [X] DCMTKConfig). +# +# It is a two steps process: +# +# * Step 1: Attempt to find DCMTK version providing a DCMTKConfig.cmake file. This is done +# with the help of '' +# +# * Step 2: If step 1 failed, rely on FindDCMTK.cmake to set DCMTK_* variables details below. +# +# +# +# Troubleshooting: +# +# What to do if my project find a different version of DCMTK ? +# +# Remove DCMTK entry from the CMake registry. +# Search for "CMake user package registry" on http://www.cmake.org/cmake/help/v2.8.9/cmake.html#command:find_package +# +# Details: As some point, the DCMTK build tree was exported [1][2][3]. Indeed, before the set of +# patches discussed above has been contributed to upstream DCMTK, an initial implementation of +# a DCMTK build system exporting its build tree has been implemented and has been tested by some +# folks. This had the effect of populating the CMake registry. +# +# Since Step1 does not exclude the CMake registry, when dealing with case E, the incorrect version of +# DCMTK could be found. +# +# [1] http://slicer-devel.65872.n3.nabble.com/Packaging-seems-to-work-again-tp4028121p4028134.html +# [2] https://www.assembla.com/spaces/slicerrt/tickets/244-dcmtk_dir-vs--dcmtkconfig-cmake?comment=267984263#comment:267984263 +# [3] http://www.cmake.org/cmake/help/v2.8.11/cmake.html#command:export +# +# #============================================================================= # Copyright 2004-2009 Kitware, Inc. # Copyright 2009-2010 Mathieu Malaterre @@ -26,7 +110,7 @@ # implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. # See the License for more information. #============================================================================= -# (To distribute this file outside of CMake, substitute the full +# (To distributed this file outside of CMake, substitute the full # License text for the above reference.) # @@ -35,50 +119,133 @@ # 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) +set(_dcmtk_dir_description "The directory of DCMTK build or install tree.") + +# Ensure that DCMTK_DIR is set to a reasonable default value +# so that DCMTK libraries can be found on a standard Unix distribution. +# It also overwrite the value of DCMTK_DIR after this one has been +# set by a successful discovery of DCMTK by the unpatched FindDCMTK.cmake module +# distributed with CMake (as of 0167cea) +if(NOT DCMTK_DIR OR DCMTK_DIR STREQUAL "/usr/include/dcmtk") + set(DCMTK_DIR "/usr" CACHE PATH ${_dcmtk_dir_description} FORCE) endif() +set(_SAVED_DCMTK_DIR ${DCMTK_DIR}) +# +# Step1: Attempt to find a version of DCMTK providing a DCMTKConfig.cmake file. +# +message(STATUS "Trying to find DCMTK expecting DCMTKConfig.cmake") +find_package(DCMTK QUIET NO_MODULE) +if(DCMTK_FOUND + AND NOT "x" STREQUAL "x${DCMTK_LIBRARIES}" + AND NOT "x" STREQUAL "x${DCMTK_INCLUDE_DIRS}") + message(STATUS "Trying to find DCMTK expecting DCMTKConfig.cmake - ok") + return() +else() + message(STATUS "Trying to find DCMTK expecting DCMTKConfig.cmake - failed") +endif() + +message(STATUS "Trying to find DCMTK relying on FindDCMTK.cmake") + +# Restore the value reset by the previous call to 'find_package(DCMTK QUIET NO_MODULE)' +set(DCMTK_DIR ${_SAVED_DCMTK_DIR} CACHE PATH ${_dcmtk_dir_description} FORCE) + + +# +# Step2: Attempt to find a version of DCMTK that does NOT provide a DCMTKConfig.cmake file. +# + +# prefer DCMTK_DIR over default system paths like /usr/lib +if(DCMTK_DIR) + set(CMAKE_PREFIX_PATH ${DCMTK_DIR}/lib ${CMAKE_PREFIX_PATH}) # this is given to FIND_LIBRARY or FIND_PATH +endif() + +# Find all libraries, store debug and release separately foreach(lib - dcmdata + dcmpstat + dcmsr + dcmsign + dcmtls + dcmqrdb + dcmnet + dcmjpeg dcmimage dcmimgle - dcmjpeg - dcmnet - dcmpstat - dcmqrdb - dcmsign - dcmsr - dcmtls + dcmdata + oflog + ofstd ijg12 ijg16 ijg8 - ofstd) + ) - find_library(DCMTK_${lib}_LIBRARY + # Find Release libraries + find_library(DCMTK_${lib}_LIBRARY_RELEASE ${lib} PATHS ${DCMTK_DIR}/${lib}/libsrc ${DCMTK_DIR}/${lib}/libsrc/Release - ${DCMTK_DIR}/${lib}/libsrc/Debug ${DCMTK_DIR}/${lib}/Release + ${DCMTK_DIR}/lib + ${DCMTK_DIR}/lib/Release + ${DCMTK_DIR}/dcmjpeg/lib${lib}/Release + NO_DEFAULT_PATH + ) + + # Find Debug libraries + find_library(DCMTK_${lib}_LIBRARY_DEBUG + ${lib}${DCMTK_CMAKE_DEBUG_POSTFIX} + PATHS + ${DCMTK_DIR}/${lib}/libsrc + ${DCMTK_DIR}/${lib}/libsrc/Debug ${DCMTK_DIR}/${lib}/Debug - ${DCMTK_DIR}/lib) + ${DCMTK_DIR}/lib + ${DCMTK_DIR}/lib/Debug + ${DCMTK_DIR}/dcmjpeg/lib${lib}/Debug + NO_DEFAULT_PATH + ) - mark_as_advanced(DCMTK_${lib}_LIBRARY) + mark_as_advanced(DCMTK_${lib}_LIBRARY_RELEASE) + mark_as_advanced(DCMTK_${lib}_LIBRARY_DEBUG) - if(DCMTK_${lib}_LIBRARY) - list(APPEND DCMTK_LIBRARIES ${DCMTK_${lib}_LIBRARY}) + # Add libraries to variable according to build type + if(DCMTK_${lib}_LIBRARY_RELEASE) + list(APPEND DCMTK_LIBRARIES optimized ${DCMTK_${lib}_LIBRARY_RELEASE}) + endif() + + if(DCMTK_${lib}_LIBRARY_DEBUG) + list(APPEND DCMTK_LIBRARIES debug ${DCMTK_${lib}_LIBRARY_DEBUG}) endif() endforeach() +set(CMAKE_THREAD_LIBS_INIT) +if(DCMTK_oflog_LIBRARY_RELEASE OR DCMTK_oflog_LIBRARY_DEBUG) + # Hack - Not having a DCMTKConfig.cmake file to read the settings from, we will attempt to + # find the library in all cases. + # Ideally, pthread library should be discovered only if DCMTK_WITH_THREADS is enabled. + set(CMAKE_THREAD_PREFER_PTHREAD TRUE) + find_package(Threads) +endif() + +if(CMAKE_THREAD_LIBS_INIT) + list(APPEND DCMTK_LIBRARIES ${CMAKE_THREAD_LIBS_INIT}) +endif() + +# +# SPECIFIC CASE FOR DCMTK BUILD DIR as DCMTK_DIR +# (as opposed to a DCMTK install dir) +# Have to find the source directory. +if(EXISTS ${DCMTK_DIR}/CMakeCache.txt) + load_cache(${DCMTK_DIR} READ_WITH_PREFIX "EXT" + DCMTK_SOURCE_DIR) + if(NOT EXISTS ${EXTDCMTK_SOURCE_DIR}) + message(FATAL_ERROR + "DCMTK build directory references +nonexistant DCMTK source directory ${EXTDCMTK_SOURCE_DIR}") + endif() +endif() set(DCMTK_config_TEST_HEADER osconfig.h) set(DCMTK_dcmdata_TEST_HEADER dctypes.h) @@ -92,6 +259,10 @@ 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) +set(DCMTK_oflog_TEST_HEADER oflog.h) +set(DCMTK_dcmjpls_TEST_HEADER djlsutil.h) + +set(DCMTK_INCLUDE_DIR_NAMES) foreach(dir config @@ -99,31 +270,47 @@ foreach(dir dcmimage dcmimgle dcmjpeg + dcmjpls dcmnet dcmpstat dcmqrdb dcmsign dcmsr dcmtls - ofstd) + ofstd + oflog) + if(EXTDCMTK_SOURCE_DIR) + set(SOURCE_DIR_PATH + ${EXTDCMTK_SOURCE_DIR}/${dir}/include/dcmtk/${dir}) + endif() find_path(DCMTK_${dir}_INCLUDE_DIR ${DCMTK_${dir}_TEST_HEADER} PATHS ${DCMTK_DIR}/${dir}/include ${DCMTK_DIR}/${dir} - ${DCMTK_DIR}/include/${dir} ${DCMTK_DIR}/include/dcmtk/${dir} ${DCMTK_DIR}/${dir}/include/dcmtk/${dir} + ${DCMTK_DIR}/include/${dir} + ${SOURCE_DIR_PATH} ) mark_as_advanced(DCMTK_${dir}_INCLUDE_DIR) + list(APPEND DCMTK_INCLUDE_DIR_NAMES DCMTK_${dir}_INCLUDE_DIR) if(DCMTK_${dir}_INCLUDE_DIR) + # add the 'include' path so eg + #include "dcmtk/dcmimgle/dcmimage.h" + # works + get_filename_component(_include ${DCMTK_${dir}_INCLUDE_DIR} PATH) + get_filename_component(_include ${_include} PATH) list(APPEND DCMTK_INCLUDE_DIRS - ${DCMTK_${dir}_INCLUDE_DIR}) + ${DCMTK_${dir}_INCLUDE_DIR} + ${_include}) endif() endforeach() +list(APPEND DCMTK_INCLUDE_DIRS ${DCMTK_DIR}/include) + if(WIN32) list(APPEND DCMTK_LIBRARIES netapi32 wsock32) endif() @@ -137,21 +324,28 @@ if(DCMTK_ofstd_INCLUDE_DIR) mark_as_advanced(DCMTK_dcmtk_INCLUDE_DIR) endif() -include(${CMAKE_CURRENT_LIST_DIR}/FindPackageHandleStandardArgs.cmake) -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) - # 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() +include(FindPackageHandleStandardArgs) +find_package_handle_standard_args(DCMTK + REQUIRED_VARS ${DCMTK_INCLUDE_DIR_NAMES} DCMTK_LIBRARIES + FAIL_MESSAGE "Please set DCMTK_DIR and re-run configure") + +# Workaround bug in packaging of DCMTK 3.6.0 on Debian. +# See http://bugs.debian.org/cgi-bin/bugreport.cgi?bug=637687 +if(DCMTK_FOUND AND UNIX AND NOT APPLE) + include(CheckCXXSourceCompiles) + set(CMAKE_REQUIRED_FLAGS ) + set(CMAKE_REQUIRED_DEFINITIONS ) + set(CMAKE_REQUIRED_INCLUDES ${DCMTK_INCLUDE_DIRS}) + set(CMAKE_REQUIRED_LIBRARIES ${DCMTK_LIBRARIES}) + check_cxx_source_compiles("#include \n#include \nint main(int,char*[]){return 0;}" + DCMTK_HAVE_CONFIG_H_OPTIONAL + ) + if(NOT DCMTK_HAVE_CONFIG_H_OPTIONAL) + set(DCMTK_DEFINITIONS "HAVE_CONFIG_H") + endif() +endif() + +message(STATUS "Trying to find DCMTK relying on FindDCMTK.cmake - ok") From d50cbbb03d53da6b990402a482a56b3163807dcb Mon Sep 17 00:00:00 2001 From: Matt McCormick Date: Mon, 11 Jan 2016 16:46:12 -0500 Subject: [PATCH 2/6] FindDCMTK: Obey QUIET option for find_package. --- Modules/FindDCMTK.cmake | 22 +++++++++++++++++----- 1 file changed, 17 insertions(+), 5 deletions(-) diff --git a/Modules/FindDCMTK.cmake b/Modules/FindDCMTK.cmake index 56939720a..89e9c4fb3 100644 --- a/Modules/FindDCMTK.cmake +++ b/Modules/FindDCMTK.cmake @@ -135,18 +135,27 @@ set(_SAVED_DCMTK_DIR ${DCMTK_DIR}) # # Step1: Attempt to find a version of DCMTK providing a DCMTKConfig.cmake file. # -message(STATUS "Trying to find DCMTK expecting DCMTKConfig.cmake") +if(NOT DCMTK_FIND_QUIETLY) + message(STATUS "Trying to find DCMTK expecting DCMTKConfig.cmake") +endif() find_package(DCMTK QUIET NO_MODULE) if(DCMTK_FOUND AND NOT "x" STREQUAL "x${DCMTK_LIBRARIES}" AND NOT "x" STREQUAL "x${DCMTK_INCLUDE_DIRS}") - message(STATUS "Trying to find DCMTK expecting DCMTKConfig.cmake - ok") + + if(NOT DCMTK_FIND_QUIETLY) + message(STATUS "Trying to find DCMTK expecting DCMTKConfig.cmake - ok") + endif() return() else() - message(STATUS "Trying to find DCMTK expecting DCMTKConfig.cmake - failed") + if(NOT DCMTK_FIND_QUIETLY) + message(STATUS "Trying to find DCMTK expecting DCMTKConfig.cmake - failed") + endif() endif() -message(STATUS "Trying to find DCMTK relying on FindDCMTK.cmake") +if(NOT DCMTK_FIND_QUIETLY) + message(STATUS "Trying to find DCMTK relying on FindDCMTK.cmake") +endif() # Restore the value reset by the previous call to 'find_package(DCMTK QUIET NO_MODULE)' set(DCMTK_DIR ${_SAVED_DCMTK_DIR} CACHE PATH ${_dcmtk_dir_description} FORCE) @@ -340,6 +349,7 @@ if(DCMTK_FOUND AND UNIX AND NOT APPLE) set(CMAKE_REQUIRED_DEFINITIONS ) set(CMAKE_REQUIRED_INCLUDES ${DCMTK_INCLUDE_DIRS}) set(CMAKE_REQUIRED_LIBRARIES ${DCMTK_LIBRARIES}) + set(CMAKE_REQUIRED_QUIET ${DCMTK_FIND_QUIETLY}) check_cxx_source_compiles("#include \n#include \nint main(int,char*[]){return 0;}" DCMTK_HAVE_CONFIG_H_OPTIONAL ) @@ -348,4 +358,6 @@ if(DCMTK_FOUND AND UNIX AND NOT APPLE) endif() endif() -message(STATUS "Trying to find DCMTK relying on FindDCMTK.cmake - ok") +if(NOT DCMTK_FIND_QUIETLY) + message(STATUS "Trying to find DCMTK relying on FindDCMTK.cmake - ok") +endif() From 8c8e53d06011ef476780d10601adac78baf8aead Mon Sep 17 00:00:00 2001 From: Matt McCormick Date: Tue, 12 Jan 2016 12:25:15 -0500 Subject: [PATCH 3/6] FindDCMTK: Minor documentation grammatical issues. Also remove CTK integration reference to avoid confusion. --- Modules/FindDCMTK.cmake | 13 ++++--------- 1 file changed, 4 insertions(+), 9 deletions(-) diff --git a/Modules/FindDCMTK.cmake b/Modules/FindDCMTK.cmake index 89e9c4fb3..115c26bb5 100644 --- a/Modules/FindDCMTK.cmake +++ b/Modules/FindDCMTK.cmake @@ -16,11 +16,11 @@ # the source (default to /usr) # # -# This file is able to find version of DCMTK that do or do not export +# This file is able to find version of DCMTK that does or does not export # a DCMTKConfig.cmake file. # # IMPORTANT: A set of patches has been contributed to DCMTK -# maintainers, as soon as: +# maintainers and merged upstream. As soon as: # (1) it has been integrated upstream so that it is available in # an official release (for example X.Y.Z), # (2) code bases have been updated to build against X.Y.Z @@ -65,22 +65,17 @@ # [X] DCMTKConfig ..: Means that the version of DCMTK exports a DCMTKConfig.cmake file. # # -# -# In CTK commits 52d953 and 74b4b07, the FindDCMTK.cmake module has been updated to be able -# to find both version of DCMTK ([ ] DCMTKConfig and [X] DCMTKConfig). -# -# It is a two steps process: +# It is a two step process: # # * Step 1: Attempt to find DCMTK version providing a DCMTKConfig.cmake file. This is done # with the help of '' -# # * Step 2: If step 1 failed, rely on FindDCMTK.cmake to set DCMTK_* variables details below. # # # # Troubleshooting: # -# What to do if my project find a different version of DCMTK ? +# What to do if my project finds a different version of DCMTK? # # Remove DCMTK entry from the CMake registry. # Search for "CMake user package registry" on http://www.cmake.org/cmake/help/v2.8.9/cmake.html#command:find_package From d790f4feeadc863d47ffec9d901d4bf5519001df Mon Sep 17 00:00:00 2001 From: Matt McCormick Date: Tue, 12 Jan 2016 14:44:21 -0500 Subject: [PATCH 4/6] FindDCMTK: Keep original copyright notice. This is a follow-up to 31b4700ed640bee962f9db9ce25fa84261a944d2. Remove the extra character that was added to ensure the CMake.ModuleNotices test passes. --- Modules/FindDCMTK.cmake | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Modules/FindDCMTK.cmake b/Modules/FindDCMTK.cmake index 115c26bb5..e79c2cd9b 100644 --- a/Modules/FindDCMTK.cmake +++ b/Modules/FindDCMTK.cmake @@ -105,7 +105,7 @@ # implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. # See the License for more information. #============================================================================= -# (To distributed this file outside of CMake, substitute the full +# (To distribute this file outside of CMake, substitute the full # License text for the above reference.) # From 361c199ff602d492d4261f0387d84913a0989473 Mon Sep 17 00:00:00 2001 From: Matt McCormick Date: Tue, 12 Jan 2016 15:44:10 -0500 Subject: [PATCH 5/6] FindDCMTK: Add reStructuredText formatting. --- Modules/FindDCMTK.cmake | 98 +++++++++++++++++++++-------------------- 1 file changed, 51 insertions(+), 47 deletions(-) diff --git a/Modules/FindDCMTK.cmake b/Modules/FindDCMTK.cmake index e79c2cd9b..12386169f 100644 --- a/Modules/FindDCMTK.cmake +++ b/Modules/FindDCMTK.cmake @@ -1,32 +1,35 @@ #.rst: # FindDCMTK # --------- +# Find DCMTK libraries and applications # -# - find DCMTK libraries and applications -# The module defines the following variables: +# The module defines the following variables:: # # 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 # -# DCMTK_DIR can be used to make it simpler to find the various include +# `DCMTK_DIR` can be used to make it simpler to find the various include # directories and compiled libraries if you've just compiled it in the # source tree. Just set it to the root of the tree where you extracted -# the source (default to /usr) +# the source (default to `/usr`) # # # This file is able to find version of DCMTK that does or does not export -# a DCMTKConfig.cmake file. +# a *DCMTKConfig.cmake* file. # -# IMPORTANT: A set of patches has been contributed to DCMTK -# maintainers and merged upstream. As soon as: -# (1) it has been integrated upstream so that it is available in +# .. important:: +# A set of patches has been contributed to DCMTK +# maintainers and merged upstream. As soon as: +# +# 1) it has been integrated upstream so that it is available in # an official release (for example X.Y.Z), -# (2) code bases have been updated to build against X.Y.Z -# This file could be removed. +# 2) code bases have been updated to build against X.Y.Z # -# The set of patches is listed here: https://github.com/commontk/DCMTK/compare/79030ba...f461865 +# This file could be removed. +# +# The set of patches is listed here: https://github.com/commontk/DCMTK/compare/79030ba...f461865 # # # Waiting for this to happen, build systems will have to be able @@ -35,24 +38,25 @@ # On any given system, the following combination of DCMTK version could be # considered: # -# | SYSTEM DCMTK + LOCAL DCMTK | Supported ? | -# --------------------------------------------------------------------------- -# Case A | NA + [ ] DCMTKConfig | YES | -# ------------------------------------------------------|-------------------- -# Case B | NA + [X] DCMTKConfig | YES | -# ------------------------------------------------------|-------------------- -# Case C | [ ] DCMTKConfig + NA | YES | -# ------------------------------------------------------|-------------------- -# Case D | [X] DCMTKConfig + NA | YES | -# ------------------------------------------------------|-------------------- -# Case E | [ ] DCMTKConfig + [ ] DCMTKConfig | YES (*) | -# ------------------------------------------------------|-------------------- -# Case F | [X] DCMTKConfig + [ ] DCMTKConfig | NO | -# ------------------------------------------------------|-------------------- -# Case G | [ ] DCMTKConfig + [X] DCMTKConfig | YES | -# ------------------------------------------------------|-------------------- -# Case H | [X] DCMTKConfig + [X] DCMTKConfig | YES | -# --------------------------------------------------------------------------- +# +--------+---------------------+-----------------------+-------------------+ +# | | SYSTEM DCMTK | LOCAL DCMTK | Supported ? | +# +--------+---------------------+-----------------------+-------------------+ +# | Case A | NA | [ ] DCMTKConfig | YES | +# +--------+---------------------+-----------------------+-------------------+ +# | Case B | NA | [X] DCMTKConfig | YES | +# +--------+---------------------+-----------------------+-------------------+ +# | Case C | [ ] DCMTKConfig | NA | YES | +# +--------+---------------------+-----------------------+-------------------+ +# | Case D | [X] DCMTKConfig | NA | YES | +# +--------+---------------------+-----------------------+-------------------+ +# | Case E | [ ] DCMTKConfig | [ ] DCMTKConfig | YES (*) | +# +--------+---------------------+-----------------------+-------------------+ +# | Case F | [X] DCMTKConfig | [ ] DCMTKConfig | NO | +# +--------+---------------------+-----------------------+-------------------+ +# | Case G | [ ] DCMTKConfig | [X] DCMTKConfig | YES | +# +--------+---------------------+-----------------------+-------------------+ +# | Case H | [X] DCMTKConfig | [X] DCMTKConfig | YES | +# +--------+---------------------+-----------------------+-------------------+ # # (*) See Troubleshooting section. # @@ -67,31 +71,31 @@ # # It is a two step process: # -# * Step 1: Attempt to find DCMTK version providing a DCMTKConfig.cmake file. This is done -# with the help of '' -# * Step 2: If step 1 failed, rely on FindDCMTK.cmake to set DCMTK_* variables details below. +# * Step 1: Attempt to find DCMTK version providing a DCMTKConfig.cmake file. This is done with the help of `''` +# * Step 2: If step 1 failed, rely on FindDCMTK.cmake to set DCMTK_* variables details below. # +# Troubleshooting +# ^^^^^^^^^^^^^^^ # +# What to do if my project finds a different version of DCMTK? # -# Troubleshooting: +# Remove DCMTK entry from the CMake registry per :command:`find_package` +# documentation. # -# What to do if my project finds a different version of DCMTK? +# Details +# ^^^^^^^ # -# Remove DCMTK entry from the CMake registry. -# Search for "CMake user package registry" on http://www.cmake.org/cmake/help/v2.8.9/cmake.html#command:find_package +# At some point, the DCMTK build tree was exported [1][2][3]. Indeed, before the set of +# patches discussed above has been contributed to upstream DCMTK, an initial implementation of +# a DCMTK build system exporting its build tree has been implemented and has been tested by some +# folks. This had the effect of populating the CMake registry. # -# Details: As some point, the DCMTK build tree was exported [1][2][3]. Indeed, before the set of -# patches discussed above has been contributed to upstream DCMTK, an initial implementation of -# a DCMTK build system exporting its build tree has been implemented and has been tested by some -# folks. This had the effect of populating the CMake registry. -# -# Since Step1 does not exclude the CMake registry, when dealing with case E, the incorrect version of -# DCMTK could be found. -# -# [1] http://slicer-devel.65872.n3.nabble.com/Packaging-seems-to-work-again-tp4028121p4028134.html -# [2] https://www.assembla.com/spaces/slicerrt/tickets/244-dcmtk_dir-vs--dcmtkconfig-cmake?comment=267984263#comment:267984263 -# [3] http://www.cmake.org/cmake/help/v2.8.11/cmake.html#command:export +# Since Step1 does not exclude the CMake registry, when dealing with case E, the incorrect version of +# DCMTK could be found. # +# - [1] http://slicer-devel.65872.n3.nabble.com/Packaging-seems-to-work-again-tp4028121p4028134.html +# - [2] https://www.assembla.com/spaces/slicerrt/tickets/244-dcmtk_dir-vs--dcmtkconfig-cmake?comment=267984263#comment:267984263 +# - [3] http://www.cmake.org/cmake/help/v2.8.11/cmake.html#command:export # #============================================================================= # Copyright 2004-2009 Kitware, Inc. From 4b24626e0096f5bf6d57b5861a2eb001067c8f89 Mon Sep 17 00:00:00 2001 From: Matt McCormick Date: Wed, 13 Jan 2016 10:53:03 -0500 Subject: [PATCH 6/6] FindDCMTK: Simplify documentation. --- Modules/FindDCMTK.cmake | 62 +++++++++++++---------------------------- 1 file changed, 20 insertions(+), 42 deletions(-) diff --git a/Modules/FindDCMTK.cmake b/Modules/FindDCMTK.cmake index 12386169f..63d253d90 100644 --- a/Modules/FindDCMTK.cmake +++ b/Modules/FindDCMTK.cmake @@ -1,6 +1,7 @@ #.rst: # FindDCMTK # --------- +# # Find DCMTK libraries and applications # # The module defines the following variables:: @@ -10,32 +11,29 @@ # DCMTK_FOUND - If false, don't try to use DCMTK # DCMTK_DIR - (optional) Source directory for DCMTK # -# `DCMTK_DIR` can be used to make it simpler to find the various include -# directories and compiled libraries if you've just compiled it in the -# source tree. Just set it to the root of the tree where you extracted -# the source (default to `/usr`) +# Compatibility +# ^^^^^^^^^^^^^ +# +# This module is able to find a version of DCMTK that does or does not export +# a *DCMTKConfig.cmake* file. It applies a two step process: +# +# * Step 1: Attempt to find DCMTK version providing a *DCMTKConfig.cmake* file. +# * Step 2: If step 1 failed, rely on *FindDCMTK.cmake* to set `DCMTK_*` variables details below. # # -# This file is able to find version of DCMTK that does or does not export -# a *DCMTKConfig.cmake* file. -# -# .. important:: -# A set of patches has been contributed to DCMTK -# maintainers and merged upstream. As soon as: -# -# 1) it has been integrated upstream so that it is available in -# an official release (for example X.Y.Z), -# 2) code bases have been updated to build against X.Y.Z -# -# This file could be removed. -# -# The set of patches is listed here: https://github.com/commontk/DCMTK/compare/79030ba...f461865 +# `Recent DCMTK +# `_ +# provides a *DCMTKConfig.cmake* :manual:`package configuration file +# `. To exclusively use the package configuration file +# (recommended when possible), pass the `NO_MODULE` option to +# :command:`find_package`. For example, `find_package(DCMTK NO_MODULE)`. +# This requires official DCMTK snapshot *3.6.1_20140617* or newer. # # -# Waiting for this to happen, build systems will have to be able +# Until all clients update to the more recent DCMTK, build systems will need # to support different versions of DCMTK. # -# On any given system, the following combination of DCMTK version could be +# On any given system, the following combinations of DCMTK versions could be # considered: # # +--------+---------------------+-----------------------+-------------------+ @@ -69,34 +67,14 @@ # [X] DCMTKConfig ..: Means that the version of DCMTK exports a DCMTKConfig.cmake file. # # -# It is a two step process: -# -# * Step 1: Attempt to find DCMTK version providing a DCMTKConfig.cmake file. This is done with the help of `''` -# * Step 2: If step 1 failed, rely on FindDCMTK.cmake to set DCMTK_* variables details below. -# # Troubleshooting # ^^^^^^^^^^^^^^^ # # What to do if my project finds a different version of DCMTK? # -# Remove DCMTK entry from the CMake registry per :command:`find_package` +# Remove DCMTK entry from the CMake cache per :command:`find_package` # documentation. -# -# Details -# ^^^^^^^ -# -# At some point, the DCMTK build tree was exported [1][2][3]. Indeed, before the set of -# patches discussed above has been contributed to upstream DCMTK, an initial implementation of -# a DCMTK build system exporting its build tree has been implemented and has been tested by some -# folks. This had the effect of populating the CMake registry. -# -# Since Step1 does not exclude the CMake registry, when dealing with case E, the incorrect version of -# DCMTK could be found. -# -# - [1] http://slicer-devel.65872.n3.nabble.com/Packaging-seems-to-work-again-tp4028121p4028134.html -# - [2] https://www.assembla.com/spaces/slicerrt/tickets/244-dcmtk_dir-vs--dcmtkconfig-cmake?comment=267984263#comment:267984263 -# - [3] http://www.cmake.org/cmake/help/v2.8.11/cmake.html#command:export -# + #============================================================================= # Copyright 2004-2009 Kitware, Inc. # Copyright 2009-2010 Mathieu Malaterre