I added a new configuration DebugWithReleaseCRT to our CMake scripts, which is based on pretty standard Debug config but links with Release CRT (/MD instead of /MDd) and defines _ITERATOR_DEBUG_LEVEL=0. I checked generated project file settings and all looks good:
C/C++ -> Code Generation -> RuntimeLibrary = Multi-Threaded DLL (/MD)
However when I build it I get errors like:
3>3rd-party.lib(3rd-party.obj) : error LNK2038: mismatch detected for 'RuntimeLibrary': value 'MD_DynamicRelease' doesn't match value 'MDd_DynamicDebug' in My.obj
which I read as:
your
My.cppfile is compiled with debug CRT (MDd_DynamicDebug) while you're trying to link with library3rd-party.libthat is built with release CRT (MD_DynamicRelease)
I also checked this particular file (My.cpp) settings but nothing fancy there, it inherited /MD flag from the parent project.
Why my project is linked with Debug CRT despite of specified /MD flag?
CMAKE_BUILD_TYPEis not relevant in VS case - Andriy Tylychko