Set MSVC runtime on CMake project from command line

Solution 1:

Yes! CMake does support setting the MSVC runtime library from the command line. Since CMake 3.15, you can set the MSVC runtime via CMAKE_MSVC_RUNTIME_LIBRARY:

cmake -D CMAKE_MSVC_RUNTIME_LIBRARY=MultiThreadedDebug ..

As the documentation states, this variable is used to initialize the MSVC_RUNTIME_LIBRARY CMake variable.