summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorBilly Brumley <bbrumley@gmail.com>2020-06-06 10:31:59 +0300
committerBrad King <brad.king@kitware.com>2020-06-08 08:24:57 -0400
commit796b447373ea8b085a8e41903dacdf9cc27f171a (patch)
tree2ec7a5ad11662ecdec05494509d521dcde43e49a
parente647949539f4704a00eddac2357d59ceeb8bc0ca (diff)
downloadcmake-796b447373ea8b085a8e41903dacdf9cc27f171a.tar.gz
FindOpenSSL: Fix OpenSSL 3.0.0 version extraction
Fix the regex syntax added by commit 61d746e592 (FindOpenSSL: Detect OpenSSL 3.0.0, 2020-05-27, v3.17.3~1^2). Add missing escapes. Test with `openssl-3.0.0-alpha3`. While at it, also unset a temporary variable after use.
-rw-r--r--Modules/FindOpenSSL.cmake6
1 files changed, 4 insertions, 2 deletions
diff --git a/Modules/FindOpenSSL.cmake b/Modules/FindOpenSSL.cmake
index 45b641ddef..ad1018faf8 100644
--- a/Modules/FindOpenSSL.cmake
+++ b/Modules/FindOpenSSL.cmake
@@ -419,11 +419,13 @@ if(OPENSSL_INCLUDE_DIR AND EXISTS "${OPENSSL_INCLUDE_DIR}/openssl/opensslv.h")
# Since OpenSSL 3.0.0, the new version format is MAJOR.MINOR.PATCH and
# a new OPENSSL_VERSION_STR macro contains exactly that
file(STRINGS "${OPENSSL_INCLUDE_DIR}/openssl/opensslv.h" OPENSSL_VERSION_STR
- REGEX "^#[\t ]*define[\t ]+OPENSSL_VERSION_STR[\t ]+\"([0-9])+\.([0-9])+\.([0-9])+\".*")
- string(REGEX REPLACE "^.*OPENSSL_VERSION_STR[\t ]+\"([0-9]+\.[0-9]+\.[0-9]+)\".*$"
+ REGEX "^#[\t ]*define[\t ]+OPENSSL_VERSION_STR[\t ]+\"([0-9])+\\.([0-9])+\\.([0-9])+\".*")
+ string(REGEX REPLACE "^.*OPENSSL_VERSION_STR[\t ]+\"([0-9]+\\.[0-9]+\\.[0-9]+)\".*$"
"\\1" OPENSSL_VERSION_STR "${OPENSSL_VERSION_STR}")
set(OPENSSL_VERSION "${OPENSSL_VERSION_STR}")
+
+ unset(OPENSSL_VERSION_STR)
endif ()
endif ()