From 0627a2c2ebdc9949d7a6c27d15313048fe6f8e8c Mon Sep 17 00:00:00 2001 From: Jorge Rodriguez Date: Thu, 19 Jul 2012 02:12:33 +0200 Subject: [PATCH 1/3] 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) From c1931eda37f75f4176acd3d388b66f37eeb66840 Mon Sep 17 00:00:00 2001 From: Camilla Berglund Date: Thu, 19 Jul 2012 02:15:01 +0200 Subject: [PATCH 2/3] Formatting, limited to MSVC. --- CMakeLists.txt | 26 ++++++++++++++------------ 1 file changed, 14 insertions(+), 12 deletions(-) diff --git a/CMakeLists.txt b/CMakeLists.txt index 29263cc9..016a8d31 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -15,8 +15,6 @@ 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 #-------------------------------------------------------------------- @@ -56,16 +54,20 @@ 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) + 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}) From 5e36fb0e38ab4e4e8fe3a66defd76bff8f62d1fe Mon Sep 17 00:00:00 2001 From: Camilla Berglund Date: Thu, 19 Jul 2012 02:35:34 +0200 Subject: [PATCH 3/3] Formatting. --- CMakeLists.txt | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/CMakeLists.txt b/CMakeLists.txt index 016a8d31..b80ac24e 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -193,7 +193,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()