I’m trying to build a JUCE app on Windows, but I keep getting linker errors like this:
error LNK2038: mismatch detected for 'RuntimeLibrary': value 'MT_StaticRelease' doesn't match value 'MD_DynamicRelease' in Main.obj
Specifically when I’m trying to link a static library dependency into the app, based on the warning it looks like the app is set to use a dynamic runtime library. So far I’ve tried setting both the CMAKE_MSVC_RUNTIME_LIBRARY
variable and the MSVC_RUNTIME_LIBRARY
property on the app target to use the appropriate multi-threaded runtime library as described in this thread, but that same linker error still shows up. Do I need to set something more specifically with the generator or are there some other flags I need to set or something? Any help much appreciated!
EDIT:
Turns out that vscode had automatically added /MD
to the CMAKE_CXX_FLAGS
cache entry. Changed to /MT
and everything works