I am working on a fork of OpenSSL, called QuicTLS. One of the things we are doing is switch from the customer Perl to a cmake build. A test is failing and I’m trying to figure out what I broke. The test is bringing in OQS library and I get the following error:
CMake Error at /usr/local/share/cmake-3.31/Modules/FindPackageHandleStandardArgs.cmake:233 (message):
Could NOT find OpenSSL, try to set the path to OpenSSL root folder in the
system variable OPENSSL_ROOT_DIR: (Required is at least version "1.1.1")
(found /home/runner/work/quictls/quictls/libcrypto.so, )
Call Stack (most recent call first):
/usr/local/share/cmake-3.31/Modules/FindPackageHandleStandardArgs.cmake:601 (_FPHSA_FAILURE_MESSAGE)
/usr/local/share/cmake-3.31/Modules/FindOpenSSL.cmake:691 (find_package_handle_standard_args)
CMakeLists.txt:133 (find_package)
-- Configuring incomplete, errors occurred!
So it turns out that our QuicTLS fork merges opensslv.h into configuration.h. (I thought that CMake really wants just one config file, am I wrong?). For now I jammed something into opensslv.h. Could we maybe search BOTH files? Or is my assumption wrong? Tnx.
That is the case for find_package’s “CONFIG” mode, which is used when explicitly requested or when no Find module is available. You can provide a QuicTLSConfig.cmake package configuration file by following the cmake-packages(7) manual, and then your package can be found by find_package(QuicTLS) with no help from a find module. You should also provide an adjacent QuicTLSConfigVersion.cmake package version file to make versioning work.
A find_package(OpenSSL) call will use CMake’s FindOpenSSL module, which searches for individual artifacts. That module extracts the OpenSSL version number from openssl/opensslv.h, which is expected to exist as it is a documented part of OpenSSL’s public interface.