generated from LizardByte/template-base
-
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
fd4d160
commit 8ecd2c1
Showing
2 changed files
with
40 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,33 @@ | ||
include_guard(GLOBAL) | ||
|
||
set(OPENSSL_VERSION 3.3.2) | ||
set(OPENSSL_URL "https://github.com/openssl/openssl/releases/download/openssl-${OPENSSL_VERSION}/openssl-${OPENSSL_VERSION}.tar.gz") | ||
|
||
find_package(OpenSSL ${OPENSSL_VERSION}) | ||
if(NOT OpenSSL_FOUND OR NOT TARGET OpenSSL::Crypto) | ||
message(STATUS "OpenSSL v${OPENSSL_VERSION} package not found in the system or incomplete. Falling back to FetchContent.") | ||
include(FetchContent) | ||
|
||
# Avoid warning about DOWNLOAD_EXTRACT_TIMESTAMP in CMake 3.24: | ||
if (CMAKE_VERSION VERSION_GREATER_EQUAL "3.24.0") | ||
cmake_policy(SET CMP0135 NEW) | ||
endif() | ||
|
||
FetchContent_Declare( | ||
OpenSSL | ||
URL ${OPENSSL_URL} | ||
SYSTEM | ||
OVERRIDE_FIND_PACKAGE | ||
) | ||
|
||
FetchContent_MakeAvailable(openssl) | ||
|
||
set(OpenSSL_FOUND TRUE) | ||
set(OPENSSL_INCLUDE_DIR ${OpenSSL_SOURCE_DIR}/include) | ||
set(OPENSSL_CRYPTO_LIBRARY ${OpenSSL_BINARY_DIR}/lib/libcrypto.a) | ||
set(OPENSSL_SSL_LIBRARY ${OpenSSL_BINARY_DIR}/lib/libssl.a) | ||
set(OPENSSL_LIBRARIES OpenSSL::Crypto OpenSSL::SSL) | ||
endif() | ||
|
||
message(STATUS "OpenSSL include dirs: ${OPENSSL_INCLUDE_DIR}") | ||
message(STATUS "OpenSSL libraries: ${OPENSSL_LIBRARIES}") |