Detect build config mismatch for MSVC Windows LLVM build. (#32868)
If LLVM build is done using different build configuration, Mono build will fail to static link LLVM libraries due to incompatibility between release and debug C++ runtime library, generating a lot of linker errors like this:
error LNK2038: mismatch detected for 'RuntimeLibrary': value 'MD_DynamicRelease' doesn't match value 'MDd_DynamicDebug' in mini-llvm-cpp.obj
error LNK2038: mismatch detected for '_ITERATOR_DEBUG_LEVEL': value '0' doesn't match value '2' in mini-llvm-cpp.obj
This is normally not a problem when doing local builds of LLVM but when using an external provided build, like netcore Mono build, this problem is more likely to occur.
This fix adds an additional check to make sure build configuration reported by llvm-config.exe --build-mode matches current Mono build configuration and if not give a more specific msbuild error:
error : LLVM build Configuration=Release doesn't match current Mono build Configuration=Debug
Co-authored-by: Johan Lorensson <lateralusx.github@gmail.com>