zlib icon indicating copy to clipboard operation
zlib copied to clipboard

zlib 1.3 forces /MD although I build it with /MT on Windows

Open tawmoto opened this issue 2 years ago • 5 comments

Hi, I compile my zlib as usual

 cmake -DSKIP_INSTALL_FILES=ON -DCMAKE_C_FLAGS_RELEASE=/MT -DCMAKE_STATIC_LINKER_FLAGS=/SUBSYSTEM:CONSOLE,6.01 -G"NMake Makefiles" -DCMAKE_BUILD_TYPE=RELEASE

Starting with 1.3, the integration with my project fails and seems a MT/MD problem.

When compiling 1.3, I see in the log a lot of warnings about overriding my MT with MD.

image

Tried to diff between my old working 1.2.12 and 1.3 and I could not find yet the problem, thanks.

tawmoto avatar Aug 24 '23 16:08 tawmoto

I think you must set it using this option https://cmake.org/cmake/help/latest/variable/CMAKE_MSVC_RUNTIME_LIBRARY.html.

nmoinvaz avatar Aug 24 '23 16:08 nmoinvaz

I think you must set it using this option https://cmake.org/cmake/help/latest/variable/CMAKE_MSVC_RUNTIME_LIBRARY.html.

Thank you, I will try. I am using my option with all 3rdparties without problem, so it clearly setting the MT correctly, but then it's overridden by MD. Also it's a mistery why it works with an older version, but with 1.3 it does not work.

tawmoto avatar Aug 24 '23 17:08 tawmoto

Can reproduce with CMake 3.27.8. Bisect revealed that 9889e988689cd9fcc08e45010fff9548aae3dbff is the first bad commit. I created #878 to have MSVC runtime library linkage properly configurable.

tbeu avatar Nov 19 '23 20:11 tbeu

@tawmoto: The @tbeu PR has been merged. Can you try? It is solved for you?

Neustradamus avatar Jan 19 '24 07:01 Neustradamus

@tawmoto: The @tbeu PR has been merged. Can you try? It is solved for you?

unfortunately I am unable to test these weeks, I am out of office but I trust that it works. thank you for the fix

tawmoto avatar Jan 19 '24 08:01 tawmoto