From: Richard Levitte Date: Wed, 12 May 2021 12:09:49 +0000 (+0200) Subject: Set OPENSSL_ROOT_DIR if it isn't set. X-Git-Tag: v3.0.0~19 X-Git-Url: http://www.wagner.pp.ru/gitweb/?p=openssl-gost%2Fengine.git;a=commitdiff_plain;h=6d232f8fc1f754c53164f610882fc7b62812f598 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. --- 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")