Skip to content
Closed
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
42 changes: 42 additions & 0 deletions CMake/DCMTKConfig.cmake.in
Original file line number Diff line number Diff line change
Expand Up @@ -173,4 +173,46 @@ endif()
if(NOT DCMTK_TARGETS_IMPORTED)
set(DCMTK_TARGETS_IMPORTED 1)
include(${DCMTK_TARGETS})
# When DCMTK is built inside a superproject (add_subdirectory/FetchContent),
# the build-tree export written by export(TARGETS ... NAMESPACE DCMTK::)
# also prefixes DCMTK:: onto link-interface targets owned by the
# superproject, recording nonexistent targets such as
# DCMTK::ITK::ITKZLIBModule or DCMTK::super_zlibwrap. All genuine DCMTK::
# targets were just defined by the include() above, so strip the
# mis-applied prefix from any DCMTK::-prefixed reference that is not an
# existing target. The install-tree export is written by install(EXPORT)
# and is unaffected; there this loop is a no-op.
foreach(_dcmtk_lib @DCMTK_LIBRARY_TARGETS@)
if(TARGET DCMTK::${_dcmtk_lib})
get_target_property(_dcmtk_ll DCMTK::${_dcmtk_lib} INTERFACE_LINK_LIBRARIES)
if(_dcmtk_ll)
set(_dcmtk_ll_new "")
foreach(_dcmtk_entry IN LISTS _dcmtk_ll)
set(_dcmtk_name "${_dcmtk_entry}")
set(_dcmtk_link_only 0)
if(_dcmtk_entry MATCHES "^\\$<LINK_ONLY:(.+)>$")
set(_dcmtk_name "${CMAKE_MATCH_1}")
set(_dcmtk_link_only 1)
endif()
if(_dcmtk_name MATCHES "^DCMTK::(.+)$" AND NOT TARGET "${_dcmtk_name}")
set(_dcmtk_name "${CMAKE_MATCH_1}")
endif()
if(_dcmtk_link_only)
list(APPEND _dcmtk_ll_new "$<LINK_ONLY:${_dcmtk_name}>")
else()
list(APPEND _dcmtk_ll_new "${_dcmtk_name}")
endif()
endforeach()
if(NOT "${_dcmtk_ll_new}" STREQUAL "${_dcmtk_ll}")
set_target_properties(DCMTK::${_dcmtk_lib} PROPERTIES INTERFACE_LINK_LIBRARIES "${_dcmtk_ll_new}")
endif()
unset(_dcmtk_ll_new)
unset(_dcmtk_entry)
unset(_dcmtk_name)
unset(_dcmtk_link_only)
endif()
unset(_dcmtk_ll)
endif()
endforeach()
unset(_dcmtk_lib)
endif()
Loading