FindOpenSSL: OPENSSL_ROOT_DIR inconsistent between includes and libraries
For example:
FIND_PACKAGE(OpenSSL "3.0" REQUIRED)
MESSAGE (STATUS "Found? ${OPENSSL_FOUND}")
MESSAGE (STATUS "Includes: ${OPENSSL_INCLUDE_DIR}")
MESSAGE (STATUS "Crypto library: ${OPENSSL_CRYPTO_LIBRARY}")
On a system with only OpenSSL 1.1.1 it fails with:
Could NOT find OpenSSL, try to set the path to OpenSSL root folder in the
system variable OPENSSL_ROOT_DIR: Found unsuitable version "1.1.1f", but
required is at least "3.0" (found /usr/lib/x86_64-linux-gnu/libcrypto.so, )
After exporting OPENSSL_ROOT_DIR to where the OpenSSL library 3.0 is located:
-- Found OpenSSL: /usr/lib/x86_64-linux-gnu/libcrypto.so (found suitable version "3.0.7", minimum required is "3.0")
-- Found? TRUE
-- Includes: /home/user/openssl3/include
-- Crypto library: /usr/lib/x86_64-linux-gnu/libcrypto.so
Which isn't right, /usr/lib/x86_64-linux-gnu has the 1.1.1f version, the 3.0.7 library is in /home/user/openssl3/lib64/libcrypto.so (the includes are resolved correctly).
Edited by Paco