diff --git a/Modules/FindOpenSSL.cmake b/Modules/FindOpenSSL.cmake index bff5af6e5..550528278 100644 --- a/Modules/FindOpenSSL.cmake +++ b/Modules/FindOpenSSL.cmake @@ -218,7 +218,7 @@ ENDIF(WIN32 AND NOT CYGWIN) if (OPENSSL_INCLUDE_DIR) if (_OPENSSL_VERSION) set(OPENSSL_VERSION "${_OPENSSL_VERSION}") - else (_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 REGEX "^#define[\t ]+OPENSSL_VERSION_NUMBER[\t ]+0x[0-9][0-9][0-9][0-9][0-9][0-9].*")