WIP: REMOTE_MODULE_TEST BUG: Fix DCMTK external module compatibility (ijg include paths + MSVC __cplusplus)#6072
Draft
hjmjohnson wants to merge 2 commits intoInsightSoftwareConsortium:release-5.4from
Conversation
The DCMTK ExternalProject include path loop iterates over all
_ITKDCMTK_LIB_NAMES and adds ${lib}/include to
ITKDCMTK_INCLUDE_DIRS. The internal JPEG codec libraries (ijg8,
ijg12, ijg16) have no public headers, so these paths don't exist.
When exported in INTERFACE_INCLUDE_DIRECTORIES, CMake 3.x+ raises
an error in external modules that link against ITK::ITKDCMTKModule:
Imported target "ITK::ITKDCMTKModule" includes non-existent path
".../ITKDCMTK_ExtProject/ijg12/include"
Skip libs matching "^ijg" in the include path loop. These are
internal JPEG codecs used only by dcmjpeg and never needed in
consumer include paths.
Fixes ITKIOTransformDCMTK#17 (Linux build failure).
MSVC does not set __cplusplus to the correct value by default — it always returns 199711L regardless of the actual standard being compiled with. DCMTK's osconfig.h checks: #if defined(HAVE_CXX11) && __cplusplus < 201103L #error DCMTK was configured to use C++11 features, but ... #endif This fires on MSVC even when C++17 is enabled because __cplusplus reports 199711L. The /Zc:__cplusplus flag (available since VS2017 15.7, MSVC 19.14) makes the compiler report the true value. ITK already requires MSVC 19.20+ so this flag is always available. Fixes ITKIOTransformDCMTK#17 (Windows build failure).
This was referenced Apr 15, 2026
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Fix two DCMTK issues that break external module builds (e.g., ITKIOTransformDCMTK). Backport candidate for v5.4.6 per #6051.
Issue 1 (Linux): DCMTK internal JPEG codec libraries (ijg8, ijg12, ijg16) are included in the INTERFACE_INCLUDE_DIRECTORIES loop, but these libraries have no public headers. The exported paths don't exist, causing CMake configure errors in external modules.
Issue 2 (Windows): MSVC reports
__cplusplus == 199711Lregardless of the actual C++ standard. DCMTK'sosconfig.hchecks__cplusplus >= 201103Land raises#erroron MSVC even with C++17 enabled. Adding/Zc:__cplusplusmakes MSVC report the true value.Downstream impact
Commits
ijg8/ijg12/ijg16in the include path loopitkCompilerChecks.cmake, append/Zc:__cpluspluswhen building with MSVC (available since 19.14, we require 19.20+)