diff options
author | Ingo Bauersachs <ingo.bauersachs@xovis.com> | 2022-12-01 18:39:52 +0100 |
---|---|---|
committer | Azat Khuzhin <azat@libevent.org> | 2023-05-16 07:46:56 +0200 |
commit | acfac7ae4a3edbbb7ce4ceee7208b4245a6e203e (patch) | |
tree | d5cff6a42f735e390e30a8ededa681b12a35ff09 /libevent_core.pc.in | |
parent | 81c6b8823c1b58d7837e827bb1098aa5f9e5956b (diff) | |
download | libevent-acfac7ae4a3edbbb7ce4ceee7208b4245a6e203e.tar.gz |
Make dependency paths relocatable
The generated configurations for both CMake and pkg-config included
absolute paths to dependencies (OpenSSL, MbedTLS). This is contrary
to the general CMake advise to create relocatable packages [1].
Additionally, when building both mbedtls and libevent via CMake's
FetchContent in the same project, loading the project would fail with
INTERFACE_INCLUDE_DIRECTORIES property contains path:
"/home/user/project/cmake-build/_deps/mbedtls-build/include"
which is prefixed in the source directory.
The required changes include:
- Adding the outer includes only to the BUILD_INTERFACE solves the
makes the CMake paths relocatable and thus solves the FetchContent
problem.
- Updates to libevent_*.pc.in fixes the relocatable issues for
pkg-config and properly declares currently missing dependencies.
- Using components for linking to OpenSSL (requiring CMake 3.4)
and MbedTLS. The new MbedTLS target names now match the component
names of the MbedTLS' CMake project.
- Use the Threads CMake library reference instead of a direct
reference to support both built-in pthread and -lpthread.
v2 (azat): get back CMAKE_REQUIRED_LIBRARIES
[1] https://cmake.org/cmake/help/v3.25/manual/cmake-packages.7.html#creating-relocatable-packages
Diffstat (limited to 'libevent_core.pc.in')
-rw-r--r-- | libevent_core.pc.in | 5 |
1 files changed, 1 insertions, 4 deletions
diff --git a/libevent_core.pc.in b/libevent_core.pc.in index 98ab1efe..eca8dabe 100644 --- a/libevent_core.pc.in +++ b/libevent_core.pc.in @@ -8,9 +8,6 @@ includedir=@includedir@ Name: libevent_core Description: libevent_core Version: @VERSION@ -Requires: -Conflicts: -Libs: -L${libdir} -levent_core +Libs: -L${libdir} -levent_core@CMAKE_DEBUG_POSTFIX@ Libs.private: @LIBS@ Cflags: -I${includedir} - |