diff --git a/CMakeLists.txt b/CMakeLists.txt index bd3e944c..a11f2c71 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -69,6 +69,21 @@ if (_GLFW_WIN32_WGL) list(APPEND glfw_INCLUDE_DIRS ${OPENGL_INCLUDE_DIR}) list(APPEND glfw_LIBRARIES ${OPENGL_gl_LIBRARY}) + if (MSVC) + option(USE_MSVC_RUNTIME_LIBRARY_DLL "Use MSVC runtime library DLL" ON) + + if (NOT USE_MSVC_RUNTIME_LIBRARY_DLL) + foreach (flag CMAKE_C_FLAGS CMAKE_C_FLAGS_DEBUG CMAKE_C_FLAGS_RELEASE CMAKE_C_FLAGS_MINSIZEREL CMAKE_C_FLAGS_RELWITHDEBINFO) + if (${flag} MATCHES "/MD") + string(REGEX REPLACE "/MD" "/MT" ${flag} "${${flag}}") + endif() + if (${flag} MATCHES "/MDd") + string(REGEX REPLACE "/MDd" "/MTd" ${flag} "${${flag}}") + endif() + endforeach() + endif() + endif() + set(_GLFW_NO_DLOAD_WINMM ${BUILD_SHARED_LIBS}) if (BUILD_SHARED_LIBS) @@ -251,7 +266,7 @@ if (_GLFW_COCOA_NSGL) set(CMAKE_OSX_ARCHITECTURES ppc;i386;ppc64;x86_64) set(CMAKE_OSX_SYSROOT /Developer/SDKs/MacOSX10.5.sdk) set(CMAKE_C_FLAGS "-mmacosx-version-min=10.5") - else(GLFW_BUILD_UNIVERSAL) + else() message(STATUS "Building GLFW only for the native architecture") endif()