miniupnpc/CMakeLists.txt: generate and install miniupnpc.pc

fixes #574
This commit is contained in:
Thomas Bernard 2022-01-23 00:45:11 +01:00
parent 3a2b15af4c
commit 5a398006b9
No known key found for this signature in database
GPG Key ID: DB511043A31ACAAF
2 changed files with 24 additions and 0 deletions

View File

@ -219,6 +219,8 @@ if (UPNPC_BUILD_TESTS)
# set (UPNPC_INSTALL_TARGETS ${UPNPC_INSTALL_TARGETS} testminixml minixmlvalid testupnpreplyparse testigddescparse testminiwget) # set (UPNPC_INSTALL_TARGETS ${UPNPC_INSTALL_TARGETS} testminixml minixmlvalid testupnpreplyparse testigddescparse testminiwget)
endif () endif ()
configure_file(miniupnpc.pc.in miniupnpc.pc @ONLY)
if (NOT UPNPC_NO_INSTALL) if (NOT UPNPC_NO_INSTALL)
install (FILES install (FILES
include/miniupnpc.h include/miniupnpc.h
@ -237,6 +239,10 @@ if (NOT UPNPC_NO_INSTALL)
install(FILES miniupnpc-config.cmake install(FILES miniupnpc-config.cmake
DESTINATION ${CMAKE_INSTALL_LIBDIR}/cmake/miniupnpc DESTINATION ${CMAKE_INSTALL_LIBDIR}/cmake/miniupnpc
) )
install(FILES ${CMAKE_CURRENT_BINARY_DIR}/miniupnpc.pc
DESTINATION ${CMAKE_INSTALL_LIBDIR}/pkgconfig
)
endif() endif()
# vim: ts=2:sw=2:expandtab # vim: ts=2:sw=2:expandtab

18
miniupnpc/miniupnpc.pc.in Normal file
View File

@ -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}"