From 0627a2c2ebdc9949d7a6c27d15313048fe6f8e8c Mon Sep 17 00:00:00 2001 From: Jorge Rodriguez Date: Thu, 19 Jul 2012 02:12:33 +0200 Subject: [PATCH] Added option for MSVC static runtime library. --- CMakeLists.txt | 13 +++++++++++++ 1 file changed, 13 insertions(+) diff --git a/CMakeLists.txt b/CMakeLists.txt index 44dcb4d4..29263cc9 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -15,6 +15,8 @@ option(BUILD_SHARED_LIBS "Build shared libraries" OFF) find_package(OpenGL REQUIRED) +option(USE_MSVC_RUNTIME_LIBRARY_DLL "Use MSVC runtime library DLL" ON) + #-------------------------------------------------------------------- # Enable all warnings on GCC, regardless of OS #-------------------------------------------------------------------- @@ -54,6 +56,17 @@ if (_GLFW_WIN32_WGL) list(APPEND glfw_INCLUDE_DIRS ${OPENGL_INCLUDE_DIR}) list(APPEND glfw_LIBRARIES ${OPENGL_gl_LIBRARY}) + if (NOT USE_MSVC_RUNTIME_LIBRARY_DLL) + foreach(flag_var CMAKE_C_FLAGS CMAKE_C_FLAGS_DEBUG CMAKE_C_FLAGS_RELEASE CMAKE_C_FLAGS_MINSIZEREL CMAKE_C_FLAGS_RELWITHDEBINFO) + if(${flag_var} MATCHES "/MD") + string(REGEX REPLACE "/MD" "/MT" ${flag_var} "${${flag_var}}") + endif(${flag_var} MATCHES "/MD") + if(${flag_var} MATCHES "/MDd") + string(REGEX REPLACE "/MDd" "/MTd" ${flag_var} "${${flag_var}}") + endif(${flag_var} MATCHES "/MDd") + endforeach(flag_var) + endif(NOT USE_MSVC_RUNTIME_LIBRARY_DLL) + set(_GLFW_NO_DLOAD_WINMM ${BUILD_SHARED_LIBS}) if (BUILD_SHARED_LIBS)