Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Make OpenSSL static link on all operating systems preferentially #1229

Open
wants to merge 2 commits into
base: develop
Choose a base branch
from
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
12 changes: 8 additions & 4 deletions CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -63,12 +63,16 @@ target_include_directories(Etterna PUBLIC ${CMAKE_CURRENT_SOURCE_DIR}/src)
## Package Includes
### OpenSSL is not used directly by our program, but we have to use OpenSSL first
### in order to statically link. Once find_package is run once, it's results are cached
if (WIN32 OR APPLE)
set(OPENSSL_USE_STATIC_LIBS ON CACHE BOOL "" FORCE)
endif()
set(OPENSSL_USE_STATIC_LIBS ON CACHE BOOL "")
set(OPENSSL_MSVC_STATIC_RT ON CACHE BOOL "" FORCE)

find_package(OpenSSL REQUIRED)
find_package(OpenSSL)
# If a static version of OpenSSL cannot be found then try a dynamic link, if that fails then error (REQUIRED)
if(NOT OPENSSL_FOUND)
set(OPENSSL_USE_STATIC_LIBS OFF CACHE BOOL "" FORCE)
find_package(OpenSSL REQUIRED)
endif()

find_package(Threads REQUIRED)
target_link_libraries(Etterna PRIVATE Threads::Threads)
target_link_libraries(Etterna PRIVATE OpenSSL::SSL)
Expand Down