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.
This commit is contained in:
Camilla Löwy 2020-10-12 23:47:35 +02:00
parent 9416a43404
commit f4a7329604
3 changed files with 10 additions and 2 deletions

View File

@ -69,8 +69,8 @@ endif()
#-------------------------------------------------------------------- #--------------------------------------------------------------------
# Set compiler specific flags # Set compiler specific flags
#-------------------------------------------------------------------- #--------------------------------------------------------------------
if (MSVC) if (MSVC AND NOT USE_MSVC_RUNTIME_LIBRARY_DLL)
if (NOT USE_MSVC_RUNTIME_LIBRARY_DLL) if (${CMAKE_VERSION} VERSION_LESS 3.15)
foreach (flag CMAKE_C_FLAGS foreach (flag CMAKE_C_FLAGS
CMAKE_C_FLAGS_DEBUG CMAKE_C_FLAGS_DEBUG
CMAKE_C_FLAGS_RELEASE CMAKE_C_FLAGS_RELEASE
@ -85,6 +85,8 @@ if (MSVC)
endif() endif()
endforeach() endforeach()
else()
set(CMAKE_MSVC_RUNTIME_LIBRARY "MultiThreaded$<$<CONFIG:Debug>:Debug>")
endif() endif()
endif() endif()

View File

@ -163,6 +163,8 @@ information on what to include when reporting a bug.
(#1582) (#1582)
- [Win32] Bugfix: `GLFW_SCALE_TO_MONITOR` had no effect on systems older than - [Win32] Bugfix: `GLFW_SCALE_TO_MONITOR` had no effect on systems older than
Windows 10 version 1703 (#1511) Windows 10 version 1703 (#1511)
- [Win32] Bugfix: `USE_MSVC_RUNTIME_LIBRARY_DLL` had no effect on CMake 3.15 or
later (#1783,#1796)
- [Cocoa] Added support for `VK_EXT_metal_surface` (#1619) - [Cocoa] Added support for `VK_EXT_metal_surface` (#1619)
- [Cocoa] Added locating the Vulkan loader at runtime in an application bundle - [Cocoa] Added locating the Vulkan loader at runtime in an application bundle
- [Cocoa] Moved main menu creation to GLFW initialization time (#1649) - [Cocoa] Moved main menu creation to GLFW initialization time (#1649)

View File

@ -235,6 +235,10 @@ __USE_MSVC_RUNTIME_LIBRARY_DLL__ determines whether to use the DLL version or th
static library version of the Visual C++ runtime library. If set to `ON`, the static library version of the Visual C++ runtime library. If set to `ON`, the
DLL version of the Visual C++ library is used. DLL version of the Visual C++ library is used.
@note On CMake 3.15 and later you can set the
[CMAKE_MSVC_RUNTIME_LIBRARY](https://cmake.org/cmake/help/latest/variable/CMAKE_MSVC_RUNTIME_LIBRARY.html)
variable instead of this option.
@anchor GLFW_USE_HYBRID_HPG @anchor GLFW_USE_HYBRID_HPG
__GLFW_USE_HYBRID_HPG__ determines whether to export the `NvOptimusEnablement` and __GLFW_USE_HYBRID_HPG__ determines whether to export the `NvOptimusEnablement` and
`AmdPowerXpressRequestHighPerformance` symbols, which force the use of the `AmdPowerXpressRequestHighPerformance` symbols, which force the use of the