Add exporters for CMake
CMake's older package finder, FindOpenSSL.cmake, does a best guess effort
and doesn't always get it right.
By CMake's own documentation, that's what such modules are (best effort
attempts), and package producers are (strongly) encouraged to help out by
producing and installing <PackageName>Config.cmake files to get a more
deterministic configuration.
The resulting OpenSSLConfig.cmake tries to mimic the result from CMake's
FindOpenSSL.cmake, by using the same variable and imported target names.
It also adds a few extra variables of its own, such as:
OPENSSL_MODULES_DIR Indicates the default installation directory
for OpenSSL loadable modules, such as providers.
OPENSSL_RUNTIME_DIR Indicates the default runtime directory, where
for example the openssl program is located.
OPENSSL_PROGRAM Is the full directory-and-filename of the
openssl program.
The imported targets OpenSSL::Crypto and OpenSSL::SSL are as precisely
specified as possible, so for example, they are specified with the both the
import library and the DLL on Windows, which should make life easier on that
platform.
For the moment, one of the following must be done in your CMake project for
this CMake configuration to take priority over CMake's FindOpenSSL.cmake:
- The variable CMAKE_FIND_PACKAGE_PREFER_CONFIG must be set to true prior
to the 'find_package(OpenSSL)' call.
- The 'find_package' call itself must use the "Full Signature". If you
don't know any better, simply add the 'CONFIG' option, i.e. from this
example:
find_package(OpenSSL 3.0 REQUIRED)
to this:
find_package(OpenSSL 3.0 REQUIRED CONFIG)
Just as with the 'pkg-config' exporters, two variants of the .cmake files
are produced:
- Those in 'exporters/' are installed in the location that 'pkg-config'
itself prefers for installed packages.
- Those in the top directory are to be used when it's desirable to build
directly against an OpenSSL build tree.
Reviewed-by: Paul Dale <pauli@openssl.org>
Reviewed-by: Tomas Mraz <tomas@openssl.org>
(Merged from https://github.com/openssl/openssl/pull/20878)
2023-05-03 18:36:09 +08:00
|
|
|
# For installation: OpenSSLConfig.cmake, OpenSSLConfigVersion.cmake
|
|
|
|
GENERATE[OpenSSLConfig.cmake]{exporter=cmake}=cmake/OpenSSLConfig.cmake.in
|
|
|
|
DEPEND[OpenSSLConfig.cmake]=../installdata.pm
|
|
|
|
GENERATE[OpenSSLConfigVersion.cmake]{exporter=cmake}=cmake/OpenSSLConfigVersion.cmake.in
|
|
|
|
DEPEND[OpenSSLConfigVersion.cmake]=../installdata.pm
|
|
|
|
DEPEND[OpenSSLConfigVersion.cmake]=OpenSSLConfig.cmake
|
|
|
|
|
|
|
|
DEPEND[""]=OpenSSLConfigVersion.cmake
|
|
|
|
|
2023-05-03 18:29:00 +08:00
|
|
|
# For installation: libcrypto.pc, libssl.pc, and openssl.pc
|
|
|
|
GENERATE[libcrypto.pc]{exporter=pkg-config}=pkg-config/libcrypto.pc.in
|
|
|
|
DEPEND[libcrypto.pc]=../installdata.pm
|
|
|
|
GENERATE[libssl.pc]{exporter=pkg-config}=pkg-config/libssl.pc.in
|
|
|
|
DEPEND[libssl.pc]=../installdata.pm
|
|
|
|
GENERATE[openssl.pc]{exporter=pkg-config}=pkg-config/openssl.pc.in
|
|
|
|
DEPEND[openssl.pc]=../installdata.pm
|
|
|
|
DEPEND[openssl.pc]=libcrypto.pc libssl.pc
|
|
|
|
|
|
|
|
DEPEND[""]=openssl.pc
|
|
|
|
|
|
|
|
GENERATE[../installdata.pm]=../util/mkinstallvars.pl \
|
2024-06-20 20:30:16 +08:00
|
|
|
"PREFIX=$(INSTALLTOP)" BINDIR=bin "LIBDIR=$(LIBDIR)" "libdir=$(libdir)" \
|
2023-05-03 18:29:00 +08:00
|
|
|
INCLUDEDIR=include APPLINKDIR=include/openssl \
|
|
|
|
"ENGINESDIR=$(ENGINESDIR)" "MODULESDIR=$(MODULESDIR)" \
|
Add exporters for CMake
CMake's older package finder, FindOpenSSL.cmake, does a best guess effort
and doesn't always get it right.
By CMake's own documentation, that's what such modules are (best effort
attempts), and package producers are (strongly) encouraged to help out by
producing and installing <PackageName>Config.cmake files to get a more
deterministic configuration.
The resulting OpenSSLConfig.cmake tries to mimic the result from CMake's
FindOpenSSL.cmake, by using the same variable and imported target names.
It also adds a few extra variables of its own, such as:
OPENSSL_MODULES_DIR Indicates the default installation directory
for OpenSSL loadable modules, such as providers.
OPENSSL_RUNTIME_DIR Indicates the default runtime directory, where
for example the openssl program is located.
OPENSSL_PROGRAM Is the full directory-and-filename of the
openssl program.
The imported targets OpenSSL::Crypto and OpenSSL::SSL are as precisely
specified as possible, so for example, they are specified with the both the
import library and the DLL on Windows, which should make life easier on that
platform.
For the moment, one of the following must be done in your CMake project for
this CMake configuration to take priority over CMake's FindOpenSSL.cmake:
- The variable CMAKE_FIND_PACKAGE_PREFER_CONFIG must be set to true prior
to the 'find_package(OpenSSL)' call.
- The 'find_package' call itself must use the "Full Signature". If you
don't know any better, simply add the 'CONFIG' option, i.e. from this
example:
find_package(OpenSSL 3.0 REQUIRED)
to this:
find_package(OpenSSL 3.0 REQUIRED CONFIG)
Just as with the 'pkg-config' exporters, two variants of the .cmake files
are produced:
- Those in 'exporters/' are installed in the location that 'pkg-config'
itself prefers for installed packages.
- Those in the top directory are to be used when it's desirable to build
directly against an OpenSSL build tree.
Reviewed-by: Paul Dale <pauli@openssl.org>
Reviewed-by: Tomas Mraz <tomas@openssl.org>
(Merged from https://github.com/openssl/openssl/pull/20878)
2023-05-03 18:36:09 +08:00
|
|
|
"PKGCONFIGDIR=$(PKGCONFIGDIR)" "CMAKECONFIGDIR=$(CMAKECONFIGDIR)" \
|
|
|
|
"LDLIBS=$(LIB_EX_LIBS)" "VERSION=$(VERSION)"
|