Skip to content

Commit db3a9f7

Browse files
SamVanheerzpostfacto
authored andcommitted
Set OPENSSL_MSVC_STATIC_RT to value of MSVC_CRT_STATIC and update manual windows building instructions
#232
1 parent 9a61630 commit db3a9f7

File tree

2 files changed

+14
-0
lines changed

2 files changed

+14
-0
lines changed

BUILDING_WINDOWS_MANUAL.md

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -48,6 +48,14 @@ easier. Be sure to pick the installers **without** the "Light"suffix. In this in
4848
For CMake to find the libraries, you may need to set the environment variable
4949
`OPENSSL_ROOT_DIR`.
5050

51+
If you are linking statically with OpenSSL you will need to set `OPENSSL_USE_STATIC_LIBS` to `ON`.
52+
`OPENSSL_MSVC_STATIC_RT` is automatically matched to the value of `MSVC_CRT_STATIC`.
53+
54+
Both need to be set before any calls to `find_package(OpenSSL REQUIRED)` because CMake caches the paths to libraries.
55+
When building GameNetworkingSockets by itself it is sufficient to set these variables on the command line or in the GUI before first configuration.
56+
57+
See the documentation for [FindOpenSSL](https://cmake.org/cmake/help/latest/module/FindOpenSSL.html) for more information about CMake variables involing OpenSSL.
58+
5159
#### Protobuf
5260

5361
Instructions for getting a working installation of google protobuf on Windows can

CMakeLists.txt

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -97,6 +97,12 @@ if (WIN32)
9797
endif()
9898

9999
if (USE_CRYPTO STREQUAL "OpenSSL")
100+
# Match the OpenSSL runtime to our setting.
101+
# 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})
104+
endif()
105+
100106
find_package(OpenSSL REQUIRED)
101107
message( STATUS "OPENSSL_INCLUDE_DIR = ${OPENSSL_INCLUDE_DIR}" )
102108

0 commit comments

Comments
 (0)