Skip to content

Commit

Permalink
Set OPENSSL_MSVC_STATIC_RT to value of MSVC_CRT_STATIC and update man…
Browse files Browse the repository at this point in the history
…ual windows building instructions

#232
  • Loading branch information
SamVanheer authored and zpostfacto committed Jun 13, 2022
1 parent 9a61630 commit db3a9f7
Show file tree
Hide file tree
Showing 2 changed files with 14 additions and 0 deletions.
8 changes: 8 additions & 0 deletions BUILDING_WINDOWS_MANUAL.md
Expand Up @@ -48,6 +48,14 @@ easier. Be sure to pick the installers **without** the "Light"suffix. In this in
For CMake to find the libraries, you may need to set the environment variable
`OPENSSL_ROOT_DIR`.

If you are linking statically with OpenSSL you will need to set `OPENSSL_USE_STATIC_LIBS` to `ON`.
`OPENSSL_MSVC_STATIC_RT` is automatically matched to the value of `MSVC_CRT_STATIC`.

Both need to be set before any calls to `find_package(OpenSSL REQUIRED)` because CMake caches the paths to libraries.
When building GameNetworkingSockets by itself it is sufficient to set these variables on the command line or in the GUI before first configuration.

See the documentation for [FindOpenSSL](https://cmake.org/cmake/help/latest/module/FindOpenSSL.html) for more information about CMake variables involing OpenSSL.

#### Protobuf

Instructions for getting a working installation of google protobuf on Windows can
Expand Down
6 changes: 6 additions & 0 deletions CMakeLists.txt
Expand Up @@ -97,6 +97,12 @@ if (WIN32)
endif()

if (USE_CRYPTO STREQUAL "OpenSSL")
# Match the OpenSSL runtime to our setting.
# Note that once found the library paths are cached and will not change if the option is changed.
if (MSVC)
set(OPENSSL_MSVC_STATIC_RT ${MSVC_CRT_STATIC})
endif()

find_package(OpenSSL REQUIRED)
message( STATUS "OPENSSL_INCLUDE_DIR = ${OPENSSL_INCLUDE_DIR}" )

Expand Down

0 comments on commit db3a9f7

Please sign in to comment.