I’m in the process of getting a JUCE app to link against the essentia library.
What seems like the penultimate hoop I need to jump through is linking against a pre-compiled static lib which is linked against the MT_StaticRelease flavour of the Windows runtime.
There is a crash happening on start up which I need to debug, but I am only able to run the release build.
I think I need to force the app to build against the the same Windows runtime as the static lib I’m linking against.
I am calling this in my top-level CMakeLists (note, without the debug bits)
set(CMAKE_MSVC_RUNTIME_LIBRARY "MultiThreaded")
However I still get this error
error LNK2038: mismatch detected for 'RuntimeLibrary': value 'MT_StaticRelease' doesn't match value 'MTd_StaticDebug' in Window.obj
This will only affect juceaide, so it’s probably unrelated to the issue you’re seeing.
error LNK2038: mismatch detected for 'RuntimeLibrary': value 'MT_StaticRelease' doesn't match value 'MTd_StaticDebug' in Window.obj
Assuming that Window.obj is the object file generated from your own file named Window.cpp, it sounds like the CMAKE_MSVC_RUNTIME_LIBRARY option isn’t having an effect.
I’d suggest checking where set(CMAKE_MSVC_RUNTIME_LIBRARY "MultiThreaded") is called, and moving it so that it is called as early as possible. If you’re pulling in other dependencies, maybe try printing/debugging the value of CMAKE_MSVC_RUNTIME_LIBRARY at various points to check that none of those are forcefully overriding this option. Finally, you could try setting the MSVC_RUNTIME_LIBRARY property directly on your target. You can also use get_target_property to query this value.
It may help to remove and recreate your build folder, just to be sure that new object files have been generated.