summaryrefslogtreecommitdiffstats
path: root/Modules/FindOpenSSL.cmake
diff options
context:
space:
mode:
authorJames Calo <jamesafcalo@gmail.com>2022-05-28 22:30:22 (GMT)
committerBrad King <brad.king@kitware.com>2022-06-02 15:14:45 (GMT)
commit4a6caef9d57f823cf0cfa9087ebe072d263d1b18 (patch)
tree58f394a2a88638da76423767b12c0da31424df23 /Modules/FindOpenSSL.cmake
parent04ff55791754c3c969e6fc5c41d2be19e1088bdb (diff)
downloadCMake-4a6caef9d57f823cf0cfa9087ebe072d263d1b18.zip
CMake-4a6caef9d57f823cf0cfa9087ebe072d263d1b18.tar.gz
CMake-4a6caef9d57f823cf0cfa9087ebe072d263d1b18.tar.bz2
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.
Diffstat (limited to 'Modules/FindOpenSSL.cmake')
-rw-r--r--Modules/FindOpenSSL.cmake8
1 files changed, 8 insertions, 0 deletions
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 ()