From 50c6b04121c6bfb7184095f047ca8cb48a80acd0 Mon Sep 17 00:00:00 2001 From: Sebastian Reimers Date: Sat, 27 Aug 2022 14:13:50 +0200 Subject: [PATCH] cmake: add pkgconfig --- CMakeLists.txt | 30 +++++++++++++++++++++--------- packaging/libre.pc.in | 12 ++++++++++++ 2 files changed, 33 insertions(+), 9 deletions(-) create mode 100644 packaging/libre.pc.in diff --git a/CMakeLists.txt b/CMakeLists.txt index d94c13515..b0100206d 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -12,7 +12,12 @@ cmake_minimum_required(VERSION 3.7) -project(re VERSION 2.6.1 LANGUAGES C) +project(re + VERSION 2.6.1 + LANGUAGES C + HOMEPAGE_URL https://github.com/baresip/re + DESCRIPTION "Generic library for real-time communications" +) set(PROJECT_SOVERSION 8) # bump if ABI breaks @@ -554,6 +559,18 @@ set_target_properties(re PROPERTIES OUTPUT_NAME "re-static") endif() +############################################################################## +# +# Packaging section +# + +if(CMAKE_SOURCE_DIR STREQUAL CMAKE_CURRENT_SOURCE_DIR) + add_subdirectory(packaging) +endif() + +configure_file(packaging/libre.pc.in libre.pc @ONLY) + + ############################################################################## # # Install section @@ -582,11 +599,6 @@ install(FILES cmake/re-config.cmake DESTINATION ${CMAKE_INSTALL_LIBDIR}/cmake/re ) -############################################################################## -# -# Packaging section -# - -if(CMAKE_SOURCE_DIR STREQUAL CMAKE_CURRENT_SOURCE_DIR) - add_subdirectory(packaging) -endif() +install(FILES libre.pc + DESTINATION ${CMAKE_INSTALL_LIBDIR}/pkgconfig +) diff --git a/packaging/libre.pc.in b/packaging/libre.pc.in new file mode 100644 index 000000000..256b9bed5 --- /dev/null +++ b/packaging/libre.pc.in @@ -0,0 +1,12 @@ +prefix="@CMAKE_INSTALL_PREFIX@" +exec_prefix=${prefix} +libdir={$prefix}/lib +includedir=${prefix}/include/re + +Name: @PROJECT_NAME@ +Description: @CMAKE_PROJECT_DESCRIPTION@ +Version: @PROJECT_VERSION@ +URL: @CMAKE_PROJECT_HOMEPAGE_URL@ +Libs: -L${libdir} -lre +Libs.private: -L${libdir} -lre -ldl -lssl -lcrypto -lz -lpthread +Cflags: -I${includedir}