if(MSVC) option(IGL_STATIC_RUNTIME "Use libigl with the static MSVC runtime." OFF) if(IGL_STATIC_RUNTIME) message(STATUS "MSVC -> forcing use of statically-linked runtime.") foreach(config ${CMAKE_CONFIGURATION_TYPES}) string(TOUPPER ${config} config) string(REPLACE /MD /MT CMAKE_C_FLAGS_${config} "${CMAKE_C_FLAGS_${config}}") string(REPLACE /MD /MT CMAKE_CXX_FLAGS_${config} "${CMAKE_CXX_FLAGS_${config}}") endforeach() string(REPLACE "/MDd" "/MTd" CMAKE_CXX_FLAGS_DEBUG ${CMAKE_CXX_FLAGS_DEBUG}) else() message(STATUS "MSVC -> forcing use of dynamically-linked runtime.") foreach(config ${CMAKE_CONFIGURATION_TYPES}) string(TOUPPER ${config} config) string(REPLACE /MT /MD CMAKE_C_FLAGS_${config} "${CMAKE_C_FLAGS_${config}}") string(REPLACE /MT /MD CMAKE_CXX_FLAGS_${config} "${CMAKE_CXX_FLAGS_${config}}") endforeach() string(REPLACE "/MTd" "/MDd" CMAKE_CXX_FLAGS_DEBUG ${CMAKE_CXX_FLAGS_DEBUG}) endif() # https://github.com/mozilla/sccache/issues/242 if(CMAKE_CXX_COMPILER_LAUNCHER STREQUAL "sccache") string(REGEX REPLACE "/Z[iI7]" "" CMAKE_CXX_FLAGS_DEBUG "${CMAKE_CXX_FLAGS_DEBUG}") set(CMAKE_CXX_FLAGS_DEBUG "${CMAKE_CXX_FLAGS_DEBUG} /Z7") endif() endif()