Update USE_MSVC_RUNTIME_LIBRARY_DLL for CMake 3.15

This makes USE_MSVC_RUNTIME_LIBRARY_DLL update the directory scope
CMAKE_MSVC_RUNTIME_LIBRARY variable instead of CMAKE_C_FLAGS on CMake
3.15 and later.

Solution proposed by @moritz-h.

Fixes #1783.
Closes #1796.

(cherry picked from commit f4a7329604)
This commit is contained in:
Camilla Löwy
2020-10-12 23:47:35 +02:00
parent 713711f5e9
commit 658744e222
3 changed files with 11 additions and 2 deletions
+5 -1
View File
@@ -80,8 +80,10 @@ if (MSVC)
# Workaround for VS 2008 not shipping with stdint.h
list(APPEND glfw_INCLUDE_DIRS "${GLFW_SOURCE_DIR}/deps/vs2008")
endif()
endif()
if (NOT USE_MSVC_RUNTIME_LIBRARY_DLL)
if (MSVC AND NOT USE_MSVC_RUNTIME_LIBRARY_DLL)
if (${CMAKE_VERSION} VERSION_LESS 3.15)
foreach (flag CMAKE_C_FLAGS
CMAKE_C_FLAGS_DEBUG
CMAKE_C_FLAGS_RELEASE
@@ -96,6 +98,8 @@ if (MSVC)
endif()
endforeach()
else()
set(CMAKE_MSVC_RUNTIME_LIBRARY "MultiThreaded$<$<CONFIG:Debug>:Debug>")
endif()
endif()