Skip to content

cmake: support OpenSSL 3 with older CMake#272

Open
zhanglistar wants to merge 1 commit into
quantcast:masterfrom
bigo-sg:topic/openssl3-find-module
Open

cmake: support OpenSSL 3 with older CMake#272
zhanglistar wants to merge 1 commit into
quantcast:masterfrom
bigo-sg:topic/openssl3-find-module

Conversation

@zhanglistar
Copy link
Copy Markdown

Summary

Add a project-local FindOpenSSL.cmake module so QFS can find OpenSSL 3 when
building with older CMake versions.

CMake 3.5 cannot parse the OpenSSL 3 version macros in opensslv.h, which
can cause find_package(OpenSSL) to fail even when OPENSSL_ROOT_DIR points
to a valid OpenSSL 3 installation.

The new module supports both version formats:

  • OpenSSL 3: OPENSSL_VERSION_MAJOR, OPENSSL_VERSION_MINOR,
    OPENSSL_VERSION_PATCH
  • OpenSSL 1.x: OPENSSL_VERSION_NUMBER

It also respects OPENSSL_ROOT_DIR first, which helps avoid mixing headers
and libraries from different OpenSSL installations.

Test

Tested on Ubuntu 16.04 with CMake 3.5.1 and OpenSSL 3.0.4 installed under / usr/local:

cd bld
cmake -DOPENSSL_ROOT_DIR=/usr/local ..
make -j2

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant