From 4a6caef9d57f823cf0cfa9087ebe072d263d1b18 Mon Sep 17 00:00:00 2001 From: James Calo Date: Sat, 28 May 2022 23:30:22 +0100 Subject: FindOpenSSL: Set version variables for version >= 3.0.0 The variables `OPENSSL_VERSION_MAJOR`, `OPENSSL_VERSION_MINOR` and `OPENSSL_VERSION_FIX` are now set to the correct values when using OpenSSL version >= 3.0.0, which uses a new format. --- Modules/FindOpenSSL.cmake | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/Modules/FindOpenSSL.cmake b/Modules/FindOpenSSL.cmake index d6a3a88..9278566 100644 --- a/Modules/FindOpenSSL.cmake +++ b/Modules/FindOpenSSL.cmake @@ -555,6 +555,14 @@ if(OPENSSL_INCLUDE_DIR AND EXISTS "${OPENSSL_INCLUDE_DIR}/openssl/opensslv.h") set(OPENSSL_VERSION "${OPENSSL_VERSION_STR}") + # Setting OPENSSL_VERSION_MAJOR OPENSSL_VERSION_MINOR and OPENSSL_VERSION_FIX + string(REGEX MATCHALL "([0-9])+" OPENSSL_VERSION_NUMBER "${OPENSSL_VERSION}") + list(POP_FRONT OPENSSL_VERSION_NUMBER + OPENSSL_VERSION_MAJOR + OPENSSL_VERSION_MINOR + OPENSSL_VERSION_FIX) + + unset(OPENSSL_VERSION_NUMBER) unset(OPENSSL_VERSION_STR) endif () endif () -- cgit v0.12