Skip to content

Windows runtime linking flags (/MD or /MT) are not downstreamed to internal DCMTK build #2872

@tim-evain

Description

@tim-evain

Hello ITK team!

Description

When DCMTK is built through the external project on Windows, the runtime linking flags (/MD, /MT, /MDd, /MTd) don't seem to be downstreamed into the DCMTK config by cmake.
The configuration collides when one try to build an application, as by default ITK config set dynamic linking while DCMTK set static, (ITK and DCMTK do both build seamlessly though).

Steps to Reproduce

  1. Build ITK with ITKDCMTK, ITKIODCMTK and ITKIOTransformDCMTK
  2. Compare the CMAKE_CXX_FLAGS_*** from ITK and ITKDCMTK_ExtProject cmake caches

ITK cache:

# This is the CMakeCache file.
# For build in directory: c:/Libraries/Builds/ITK_5.2.1

[...]

//Flags used by the CXX compiler during all build types.
CMAKE_CXX_FLAGS:STRING=/DWIN32 /D_WINDOWS /W3 /GR /EHsc

//Flags used by the CXX compiler during DEBUG builds.
CMAKE_CXX_FLAGS_DEBUG:STRING=/MDd /Zi /Ob0 /Od /RTC1

//Flags used by the CXX compiler during MINSIZEREL builds.
CMAKE_CXX_FLAGS_MINSIZEREL:STRING=/MD /O1 /Ob1 /DNDEBUG

//Flags used by the CXX compiler during RELEASE builds.
CMAKE_CXX_FLAGS_RELEASE:STRING=/MD /O2 /Ob2 /DNDEBUG

//Flags used by the CXX compiler during RELWITHDEBINFO builds.
CMAKE_CXX_FLAGS_RELWITHDEBINFO:STRING=/MD /Zi /O2 /Ob1 /DNDEBUG

ITKDCMTK_ExtProject cache:

# This is the CMakeCache file.
# For build in directory: c:/Libraries/Builds/ITK_5.2.1/Modules/ThirdParty/DCMTK/ITKDCMTK_ExtProject-build

[...]

//msvc compiler flags
CMAKE_CXX_FLAGS:STRING=/DWIN32 /D_WINDOWS /W3 /GR /EHsc

//msvc compiler flags
CMAKE_CXX_FLAGS_DEBUG:STRING=/MTd /Zi /Ob0 /Od /RTC1

//msvc compiler flags
CMAKE_CXX_FLAGS_MINSIZEREL:STRING=/MT /O1 /Ob1 /DNDEBUG

//msvc compiler flags
CMAKE_CXX_FLAGS_RELEASE:STRING=/MT /O2 /Ob2 /DNDEBUG

//msvc compiler flags
CMAKE_CXX_FLAGS_RELWITHDEBINFO:STRING=/MT /Zi /O2 /Ob1 /DNDEBUG

Expected behavior

ITK config overwriting DCMTK config

Actual behavior

No ITK config overwriting

Reproducibility

100%

Versions

5.2.1

Environment

OS: Windows 10
CMake: 3.21.4
Compiler: MSVC 2019 14.29.30133

Additional Information

N/A

Metadata

Metadata

Assignees

Labels

type:BugInconsistencies or issues which will cause an incorrect result under some or all circumstances

Type

No type

Projects

No projects

Relationships

None yet

Development

No branches or pull requests

Issue actions