Bug #842
closedCMake does not permit the user to select /MT or /MD build model on Windows
100%
Description
When compiling with the Visual Studio compilers on Windows, the user needs to decide whether to use the "Multithread Static" runtime (/MT) or the "Multithread DLL" runtime (/MD). All object files and libraries that are linked into an executable have to be compiled with the same setting. For this reason, the external libraries for Windows are available in an /MT and an /MD version.
The CMake build infrastructure for Windows does not permit the user to explicitly select the /MT or /MD build model. By default, CMake's own preference is selected and it is assumed that this is /MD, which is the case on most, but not all platforms. Alternatively the user can compile with -DDCMTK_OVERWRITE_WIN32_COMPILER_FLAGS, in which case /MT and a completely hard-coded set of parameters is used. This is mostly a backward-compatibility option emulating the CMake behaviour of older DCMTK releases.
What is really needed is an option that permits the user to select between /MT and /MD but still allows CMake to freely choose all other compiler options, which may vary between Visual Studio versions. A proposal how to implement this by modifying the compiler options selected by CMake can be found on Stackoverflow:
https://stackoverflow.com/questions/14172856/cmake-compile-with-mt-instead-of-md
Something like this should be implemented in DCMTK and made available as a selectable option in the CMake GUI.