Skip to content

Use standard cmake module FindOpenSSL.cmake to find OpenSSL #34

@wdobbe

Description

@wdobbe

Currently the JWT cmake file uses different ways to find OpenSSL on each platform. This makes the cmake file more complicated than necessary.

Even worse is that the standard way to let cmake find a dependency in a non-system path doesn't work. Normally if I want jwt-cpp to find an OpenSSL library installed in directory /foo/bar, I would include that path in CMAKE_PREFIX_PATH. This currently doesn't work (at least on Linux) because the cmake file uses pkconfig to find OpenSSL unless you define the following 3 (!) cmake variables:
OPENSSL_INCLUDE_DIRS
OPENSSL_LIBRARY_DIRS
OPENSSL_LIBRARIES

Also the conan recipe for jwt-cpp currently doesn't work correctly on Linux, because jwt-cpp ignores the CMAKE_PREFIX_PATH.

I suggest to keep the variables OPENSSL_INCLUDE_DIRS, OPENSSL_LIBRARY_DIRS, OPENSSL_LIBRARIES for backwards compatibility, but if they are not defined then use the normal way:
find_package(OpenSSL)
to find OpenSSL.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions