Skip to content

Commit

Permalink
build: Fixes for DCMTK (#4147)
Browse files Browse the repository at this point in the history
It somehow escaped our notice, but not only does DCMTK have an exported
config, but also CMake itself has a FindDCMTK.cmake module. So get rid
of ours, and prefer the config if available. This is hoped to solve some
edge cases for finding and using this library properly.

Fixes #4146
(I hope?)

Signed-off-by: Larry Gritz <[email protected]>
  • Loading branch information
lgritz authored Feb 20, 2024
1 parent b8bb38e commit 414f953
Show file tree
Hide file tree
Showing 4 changed files with 8 additions and 75 deletions.
3 changes: 3 additions & 0 deletions src/cmake/Config.cmake.in
Original file line number Diff line number Diff line change
Expand Up @@ -36,6 +36,9 @@ if (NOT @BUILD_SHARED_LIBS@)
if (@PNG_FOUND@)
find_dependency(PNG)
endif()
if (@DCMTK_FOUND@)
find_dependency(DCMTK)
endif()
# The following have the same problem except that INTERFACE_LINK_LIBRARIES use
# TARGET_NAME_IF_EXISTS, so the error only happens on link time.
if (@OIIO_TBB@)
Expand Down
5 changes: 4 additions & 1 deletion src/cmake/externalpackages.cmake
Original file line number Diff line number Diff line change
Expand Up @@ -200,7 +200,10 @@ checked_find_package (TBB 2017
SETVARIABLES OIIO_TBB
PREFER_CONFIG)

checked_find_package (DCMTK VERSION_MIN 3.6.1) # For DICOM images
# DCMTK is used to read DICOM images
checked_find_package (DCMTK VERSION_MIN 3.6.1
PREFER_CONFIG)

checked_find_package (FFmpeg VERSION_MIN 3.0)
checked_find_package (GIF
VERSION_MIN 4
Expand Down
72 changes: 0 additions & 72 deletions src/cmake/modules/FindDCMTK.cmake

This file was deleted.

3 changes: 1 addition & 2 deletions src/dicom.imageio/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -4,8 +4,7 @@

if (DCMTK_FOUND)
add_oiio_plugin (dicominput.cpp
INCLUDE_DIRS ${DCMTK_INCLUDE_DIR}
LINK_LIBRARIES ${DCMTK_LIBRARIES}
LINK_LIBRARIES DCMTK::DCMTK
DEFINITIONS "-DUSE_DCMTK=1")
else ()
message (WARNING "DICOM plugin will not be built, no DCMTK")
Expand Down

0 comments on commit 414f953

Please sign in to comment.