From 5a398006b90e35942ffd8015a9f792df9ec97fd8 Mon Sep 17 00:00:00 2001 From: Thomas Bernard Date: Sun, 23 Jan 2022 00:45:11 +0100 Subject: [PATCH] miniupnpc/CMakeLists.txt: generate and install miniupnpc.pc fixes #574 --- miniupnpc/CMakeLists.txt | 6 ++++++ miniupnpc/miniupnpc.pc.in | 18 ++++++++++++++++++ 2 files changed, 24 insertions(+) create mode 100644 miniupnpc/miniupnpc.pc.in diff --git a/miniupnpc/CMakeLists.txt b/miniupnpc/CMakeLists.txt index 102094c..56c97ab 100644 --- a/miniupnpc/CMakeLists.txt +++ b/miniupnpc/CMakeLists.txt @@ -219,6 +219,8 @@ if (UPNPC_BUILD_TESTS) # set (UPNPC_INSTALL_TARGETS ${UPNPC_INSTALL_TARGETS} testminixml minixmlvalid testupnpreplyparse testigddescparse testminiwget) endif () +configure_file(miniupnpc.pc.in miniupnpc.pc @ONLY) + if (NOT UPNPC_NO_INSTALL) install (FILES include/miniupnpc.h @@ -237,6 +239,10 @@ if (NOT UPNPC_NO_INSTALL) install(FILES miniupnpc-config.cmake DESTINATION ${CMAKE_INSTALL_LIBDIR}/cmake/miniupnpc ) + + install(FILES ${CMAKE_CURRENT_BINARY_DIR}/miniupnpc.pc + DESTINATION ${CMAKE_INSTALL_LIBDIR}/pkgconfig + ) endif() # vim: ts=2:sw=2:expandtab diff --git a/miniupnpc/miniupnpc.pc.in b/miniupnpc/miniupnpc.pc.in new file mode 100644 index 0000000..155cf0f --- /dev/null +++ b/miniupnpc/miniupnpc.pc.in @@ -0,0 +1,18 @@ +# this template is filled-in by CMake `configure_file(... @ONLY)` +# the `@....@` are filled in by CMake configure_file(), +# from variables set in your CMakeLists.txt or by CMake itself +# +# Good tutoral for understanding .pc files: +# https://people.freedesktop.org/~dbn/pkg-config-guide.html + +prefix="@CMAKE_INSTALL_PREFIX@" +exec_prefix="${prefix}" +libdir="${prefix}/lib" +includedir="${prefix}/include" + +Name: @PROJECT_NAME@ +Description: @CMAKE_PROJECT_DESCRIPTION@ +URL: @CMAKE_PROJECT_HOMEPAGE_URL@ +Version: @PROJECT_VERSION@ +Libs: -L"${libdir}" -lminiupnpc +Cflags: -I"${includedir}"