FindOpenSSL: Always extract version from detected header (#15075)

Do not use the _OPENSSL_VERSION computed by pkg-config because
the user may change OPENSSL_INCLUDE_DIR.
This commit is contained in:
Aku Kotkavuo 2015-01-10 00:40:20 +02:00 committed by Brad King
parent 4aa9c64511
commit 99b1382071
1 changed files with 1 additions and 3 deletions

View File

@ -283,9 +283,7 @@ function(from_hex HEX DEC)
endfunction() endfunction()
if (OPENSSL_INCLUDE_DIR) if (OPENSSL_INCLUDE_DIR)
if (_OPENSSL_VERSION) if(OPENSSL_INCLUDE_DIR AND EXISTS "${OPENSSL_INCLUDE_DIR}/openssl/opensslv.h")
set(OPENSSL_VERSION "${_OPENSSL_VERSION}")
elseif(OPENSSL_INCLUDE_DIR AND EXISTS "${OPENSSL_INCLUDE_DIR}/openssl/opensslv.h")
file(STRINGS "${OPENSSL_INCLUDE_DIR}/openssl/opensslv.h" openssl_version_str file(STRINGS "${OPENSSL_INCLUDE_DIR}/openssl/opensslv.h" openssl_version_str
REGEX "^#define[\t ]+OPENSSL_VERSION_NUMBER[\t ]+0x([0-9a-fA-F])+.*") REGEX "^#define[\t ]+OPENSSL_VERSION_NUMBER[\t ]+0x([0-9a-fA-F])+.*")