string(TOUPPER ${CMAKE_BUILD_TYPE} BUILD_TYPE_UPPER_CASE)
set(ALL_COMPILER_FLAGS
        CMAKE_CXX_FLAGS
        CMAKE_CXX_FLAGS_${BUILD_TYPE_UPPER_CASE}
        CMAKE_C_FLAGS
        CMAKE_C_FLAGS_${BUILD_TYPE_UPPER_CASE})

foreach(COMPILER_FLAGS ${ALL_COMPILER_FLAGS})
    string(REPLACE "/MD" "/MT" ${COMPILER_FLAGS} "${${COMPILER_FLAGS}}")
endforeach()
