]> wagner.pp.ru Git - openssl-gost/engine.git/commitdiff
Set OPENSSL_ROOT_DIR if it isn't set.
authorRichard Levitte <richard@levitte.org>
Wed, 12 May 2021 12:09:49 +0000 (14:09 +0200)
committerDmitry Belyavskiy <beldmit@users.noreply.github.com>
Fri, 28 May 2021 11:05:16 +0000 (14:05 +0300)
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.

CMakeLists.txt

index a6bb1785e8555bc0fbab6d99360b44a7f6588921..d705b3b51d5106ceddcc859a75352de15759bd1d 100644 (file)
@@ -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")