aboutsummaryrefslogtreecommitdiff
path: root/CMakeLists.txt
diff options
context:
space:
mode:
authorRichard Levitte <richard@levitte.org>2021-05-12 14:09:49 +0200
committerDmitry Belyavskiy <beldmit@users.noreply.github.com>2021-05-28 14:05:16 +0300
commit6d232f8fc1f754c53164f610882fc7b62812f598 (patch)
treec800c3c5a2554f678eb71915d1502e2b8915b144 /CMakeLists.txt
parent0321ed4fa2544e18001d8c50f852e676864aa980 (diff)
downloadgost-engine-6d232f8fc1f754c53164f610882fc7b62812f598.zip
gost-engine-6d232f8fc1f754c53164f610882fc7b62812f598.tar.gz
gost-engine-6d232f8fc1f754c53164f610882fc7b62812f598.tar.bz2
Set OPENSSL_ROOT_DIR if it isn't set.
These days, the OpenSSL cmake package finder is capable of finding a custom OpenSSL installation with no OPENSSL_ROOT_DIR defined, but CMAKE_PREFIX_PATH defined. However, gost-engine's CMakeLists.txt does use OPENSSL_ROOT_DIR, so it needs it to be defined unconditionally. That's arranged fairly easily by assigning it the parent directory of OPENSSL_INCLUDE_DIR.
Diffstat (limited to 'CMakeLists.txt')
-rw-r--r--CMakeLists.txt7
1 files changed, 6 insertions, 1 deletions
diff --git a/CMakeLists.txt b/CMakeLists.txt
index a6bb178..d705b3b 100644
--- a/CMakeLists.txt
+++ b/CMakeLists.txt
@@ -9,9 +9,14 @@ include(CheckCSourceRuns)
enable_testing()
find_package(OpenSSL 3.0 REQUIRED)
+
+if (NOT DEFINED OPENSSL_ROOT_DIR)
+ get_filename_component(OPENSSL_ROOT_DIR ${OPENSSL_INCLUDE_DIR} DIRECTORY)
+ message(STATUS "Setting OpenSSL root: ${OPENSSL_ROOT_DIR}")
+endif()
find_program(OPENSSL_PROGRAM openssl
PATHS ${OPENSSL_ROOT_DIR} PATH_SUFFIXES apps bin NO_DEFAULT_PATH)
-message("-- Found OpenSSL application: ${OPENSSL_PROGRAM}")
+message(STATUS "Found OpenSSL application: ${OPENSSL_PROGRAM}")
include_directories(${OPENSSL_INCLUDE_DIR})
if (CMAKE_C_COMPILER_ID MATCHES "Clang")