Skip to content

Commit fd91008

Browse files
committed
Remove custom MSVC CRT management
Use CMake's built-in CMAKE_MSVC_RUNTIME_LIBRARY instead. This requires CMake 3.15), so bump cmake_minimum_required accordingly.
1 parent 254d123 commit fd91008

2 files changed

Lines changed: 3 additions & 62 deletions

File tree

CMakeLists.txt

Lines changed: 3 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
cmake_minimum_required(VERSION 3.10)
1+
cmake_minimum_required(VERSION 3.15)
22

33
# If vcpkg present as submodule, bring in the toolchain
44
if( EXISTS ${CMAKE_SOURCE_DIR}/vcpkg/scripts/buildsystems/vcpkg.cmake )
@@ -33,7 +33,6 @@ if(SANITIZE_ADDRESS OR SANITIZE_THREAD OR SANITIZE_MEMORY OR SANITIZE_UNDEFINED)
3333
set(SANITIZE ON)
3434
endif()
3535

36-
include(FlagsMSVC)
3736
add_definitions( -DVALVE_CRYPTO_ENABLE_25519 )
3837
if(CMAKE_CXX_COMPILER_ID MATCHES "MSVC")
3938
add_definitions(
@@ -51,11 +50,6 @@ option(LTO "Enable Link-Time Optimization" OFF)
5150
option(ENABLE_ICE "Enable support for NAT-punched P2P connections using ICE protocol. Build native ICE client" ON)
5251
option(USE_STEAMWEBRTC "Build Google's WebRTC library to get ICE support for P2P" OFF)
5352
option(Protobuf_USE_STATIC_LIBS "Link with protobuf statically" OFF)
54-
if(CMAKE_CXX_COMPILER_ID MATCHES "MSVC")
55-
option(MSVC_CRT_STATIC "Link the MSVC CRT statically" OFF)
56-
configure_msvc_runtime()
57-
print_default_msvc_flags()
58-
endif()
5953

6054
#
6155
# Primary crypto library (for AES, SHA256, etc)
@@ -99,8 +93,8 @@ endif()
9993
if (USE_CRYPTO STREQUAL "OpenSSL")
10094
# Match the OpenSSL runtime to our setting.
10195
# Note that once found the library paths are cached and will not change if the option is changed.
102-
if (MSVC)
103-
set(OPENSSL_MSVC_STATIC_RT ${MSVC_CRT_STATIC})
96+
if (MSVC AND CMAKE_MSVC_RUNTIME_LIBRARY MATCHES "^MultiThreaded($|Debug$)")
97+
set(OPENSSL_MSVC_STATIC_RT TRUE)
10498
endif()
10599

106100
find_package(OpenSSL REQUIRED)

cmake/FlagsMSVC.cmake

Lines changed: 0 additions & 53 deletions
This file was deleted.

0 commit comments

Comments
 (0)