Re: LIBCMTD.lib and MSVCRTD.lib question
I use -MD (Release mode) and -MDd (Debug mode). In Debug mode, I also set the Project -> Properties -> Linker -> Input -> Ignore Specific Default Libraries property to "MSVCRT;%(IgnoreSpecificDefaultLibraries)"
This eliminates the linking errors in Debug mode. For some strange reason this setting is not needed in Release mode. I don't have any idea how to do this in CMake. The linker command line in MSVC shows /NODEFAULTLIB:"MSVCRT", so maybe adding "-NODEFAULTLIB:'MSVCRT'" to your CMAKE_CXX_FLAGS variable will do this.
You most likely cannot do static linking to the MSVC runtime libraries if you are using Qt DLLs. These will also be linked to the MSVC runtime DLLs, and you can't mix dynamic and static links to MSVC runtime libraries in the same executable.
Please use CODE tags when posting source code so it is more readable. Click "Go Advanced" and then the "#" icon to insert the tags. Paste your code between them.