Crt-static msvc debug builds

I am trying to build the RESVG rust project as a static library, and I need to link to the msvc crt statically. In release builds this works by adding

[build]
rustflags = ["-C", "target-feature=+crt-static"]

in .cargo/config

but for debug builds it still tries to link the Release CRT. Then when i try and link this library to my C++ project I get linker errors (see below)

how can I make rust link MTd_StaticDebug ?

thanks

oli

1>------ Build started: Project: IGraphicsTest-app, Configuration: Debug x64 ------

1>resvg.lib(skia_capi.o) : error LNK2038: mismatch detected for '_ITERATOR_DEBUG_LEVEL': value '0' doesn't match value '2' in RtAudio.obj
1>resvg.lib(skia_capi.o) : error LNK2038: mismatch detected for 'RuntimeLibrary': value 'MT_StaticRelease' doesn't match value 'MTd_StaticDebug' in RtAudio.obj
1>libcpmt.lib(raisehan.obj) : error LNK2038: mismatch detected for '_ITERATOR_DEBUG_LEVEL': value '0' doesn't match value '2' in RtAudio.obj
1>libcpmt.lib(raisehan.obj) : error LNK2038: mismatch detected for 'RuntimeLibrary': value 'MT_StaticRelease' doesn't match value 'MTd_StaticDebug' in RtAudio.obj
1>libcpmt.lib(thread0.obj) : error LNK2038: mismatch detected for '_ITERATOR_DEBUG_LEVEL': value '0' doesn't match value '2' in RtAudio.obj
1>libcpmt.lib(thread0.obj) : error LNK2038: mismatch detected for 'RuntimeLibrary': value 'MT_StaticRelease' doesn't match value 'MTd_StaticDebug' in RtAudio.obj
1>libcpmt.lib(xnotify.obj) : error LNK2038: mismatch detected for '_ITERATOR_DEBUG_LEVEL': value '0' doesn't match value '2' in RtAudio.obj
1>libcpmt.lib(xnotify.obj) : error LNK2038: mismatch detected for 'RuntimeLibrary': value 'MT_StaticRelease' doesn't match value 'MTd_StaticDebug' in RtAudio.obj
1>libcpmt.lib(cthread.obj) : error LNK2038: mismatch detected for '_ITERATOR_DEBUG_LEVEL': value '0' doesn't match value '2' in RtAudio.obj
1>libcpmt.lib(cthread.obj) : error LNK2038: mismatch detected for 'RuntimeLibrary': value 'MT_StaticRelease' doesn't match value 'MTd_StaticDebug' in RtAudio.obj
1>libcpmt.lib(mutex.obj) : error LNK2038: mismatch detected for '_ITERATOR_DEBUG_LEVEL': value '0' doesn't match value '2' in RtAudio.obj
1>libcpmt.lib(mutex.obj) : error LNK2038: mismatch detected for 'RuntimeLibrary': value 'MT_StaticRelease' doesn't match value 'MTd_StaticDebug' in RtAudio.obj
1>libcpmt.lib(cond.obj) : error LNK2038: mismatch detected for '_ITERATOR_DEBUG_LEVEL': value '0' doesn't match value '2' in RtAudio.obj
1>libcpmt.lib(cond.obj) : error LNK2038: mismatch detected for 'RuntimeLibrary': value 'MT_StaticRelease' doesn't match value 'MTd_StaticDebug' in RtAudio.obj
1>LIBCMTD.lib(initializers.obj) : warning LNK4098: defaultlib 'libcmt.lib' conflicts with use of other libs; use /NODEFAULTLIB:library
1>C:\Users\oli\Dev\iPlug2\Tests\IGraphicsTest\build-win\app\x64\Debug\IGraphicsTest.exe : fatal error LNK1319: 14 mismatches detected
1>Done building project "IGraphicsTest-app.vcxproj" -- FAILED.

You could specify the libraries to link yourself using -l libucrtd and -l libvcruntimed.lib (for the static debug libraries).

Side note: Windows 7+ now has the ucrt built in (assuming the computer has been update in the last four or five years). So it might be acceptable to only statically link the vcruntime. Depending on your needs, of course.