Skip to content

Commit d0a4c29

Browse files
committed
COMP: Pin DCMTK charset-conversion backend, disabling external iconv
DCMTK auto-detects an external libiconv and turns DCMTK_WITH_ICONV on when one is found, which then runs an iconv try-compile during configure. In a conda/pixi toolchain the conda iconv.h (which renames iconv -> libiconv) is paired with the macOS SDK libiconv at link time, so the probe fails with undefined _libiconv symbols and configure aborts. ITK already selects the built-in oficonv backend (DCMTK_ENABLE_BUILTIN_OFICONV_DATA), so the external-iconv probe is redundant. Set DCMTK_WITH_ICONV=OFF explicitly in both the ICU and the non-ICU branches so the backend is fixed by ITK rather than discovered from whatever the build environment happens to provide. Co-locate the three related options (DCMTK_ENABLE_BUILTIN_OFICONV_DATA, DCMTK_WITH_ICU, DCMTK_WITH_ICONV) in CHARSET_CONVERSION_ARGS so their interrelationship is visible in one place.
1 parent 3609b55 commit d0a4c29

1 file changed

Lines changed: 19 additions & 3 deletions

File tree

Modules/ThirdParty/DCMTK/CMakeLists.txt

Lines changed: 19 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -7,6 +7,14 @@ set(ITKDCMTK_NO_SRC 1)
77

88
include(CMakeParseArguments)
99

10+
# Character-set-conversion options for the DCMTK build, kept together so the
11+
# oficonv / ICU / external-iconv relationship is visible in one place. The
12+
# built-in oficonv module is always the data backend; ICU and external libiconv
13+
# are mutually exclusive add-ons selected below.
14+
set(
15+
CHARSET_CONVERSION_ARGS
16+
-DDCMTK_ENABLE_BUILTIN_OFICONV_DATA:BOOL=${DCMTK_ENABLE_BUILTIN_OFICONV_DATA}
17+
)
1018
if(DCMTK_USE_ICU)
1119
option(ITK_USE_SYSTEM_ICU "Use an installed version of ICU" OFF)
1220
if(NOT ITK_USE_SYSTEM_ICU)
@@ -81,10 +89,12 @@ if(DCMTK_USE_ICU)
8189
else()
8290
set(ICU_ROOT_DIR ${ITKDCMTK_PREREQS})
8391
endif()
84-
set(
92+
list(
93+
APPEND
8594
CHARSET_CONVERSION_ARGS
8695
-DDCMTK_WITH_STDLIBC_ICONV:BOOL=OFF
8796
-DDCMTK_WITH_ICU:BOOL=ON
97+
-DDCMTK_WITH_ICONV:BOOL=OFF
8898
-DDCMTK_ENABLE_CHARSET_CONVERSION:STRING=ICU
8999
-DICU_ROOT:PATH=${ICU_ROOT_DIR}
90100
)
@@ -109,7 +119,14 @@ if(DCMTK_USE_ICU)
109119
set(ICU_DEPENDENCY icu)
110120
endif()
111121
else()
112-
set(CHARSET_CONVERSION_ARGS -DDCMTK_WITH_ICU:BOOL=OFF)
122+
# Built-in oficonv only: disable ICU and the external libiconv probe so the
123+
# backend is fixed regardless of what the environment happens to provide.
124+
list(
125+
APPEND
126+
CHARSET_CONVERSION_ARGS
127+
-DDCMTK_WITH_ICU:BOOL=OFF
128+
-DDCMTK_WITH_ICONV:BOOL=OFF
129+
)
113130
endif()
114131

115132
set(
@@ -480,7 +497,6 @@ endforeach()
480497
-DCMAKE_INSTALL_PREFIX:PATH=${CMAKE_INSTALL_PREFIX}
481498
-DCMAKE_INSTALL_LIBDIR:PATH=${CMAKE_INSTALL_LIBDIR}
482499
-DCMAKE_INSTALL_BINDIR:PATH=${CMAKE_INSTALL_BINDIR}
483-
-DDCMTK_ENABLE_BUILTIN_OFICONV_DATA:BOOL=${DCMTK_ENABLE_BUILTIN_OFICONV_DATA}
484500
${CHARSET_CONVERSION_ARGS}
485501
DEPENDS
486502
${JPEG_DEPENDENCY}

0 commit comments

Comments
 (0)