Merge pull request #591 from miniupnp/cmake-pkg-config
miniupnpc/CMakeLists.txt: generate and install miniupnpc.pc
This commit is contained in:
commit
59335e4637
|
@ -1,8 +1,11 @@
|
|||
cmake_minimum_required(VERSION 3.5 FATAL_ERROR)
|
||||
cmake_minimum_required(VERSION 3.12 FATAL_ERROR)
|
||||
|
||||
project (miniupnpc C)
|
||||
project (miniupnpc
|
||||
VERSION 2.2.3
|
||||
DESCRIPTION "UPnP IGD client lightweight library"
|
||||
HOMEPAGE_URL https://miniupnp.tuxfamily.org/
|
||||
LANGUAGES C)
|
||||
|
||||
set (MINIUPNPC_VERSION 2.2.3)
|
||||
set (MINIUPNPC_API_VERSION 17)
|
||||
|
||||
option (UPNPC_BUILD_STATIC "Build static library" TRUE)
|
||||
|
@ -141,7 +144,7 @@ if (UPNPC_BUILD_SHARED)
|
|||
add_library (miniupnpc::miniupnpc ALIAS libminiupnpc-shared)
|
||||
set_target_properties (libminiupnpc-shared PROPERTIES EXPORT_NAME miniupnpc)
|
||||
set_target_properties (libminiupnpc-shared PROPERTIES OUTPUT_NAME "miniupnpc")
|
||||
set_target_properties (libminiupnpc-shared PROPERTIES VERSION ${MINIUPNPC_VERSION})
|
||||
set_target_properties (libminiupnpc-shared PROPERTIES VERSION ${PROJECT_VERSION})
|
||||
set_target_properties (libminiupnpc-shared PROPERTIES SOVERSION ${MINIUPNPC_API_VERSION})
|
||||
target_link_libraries (libminiupnpc-shared PRIVATE miniupnpc-private)
|
||||
target_compile_definitions(libminiupnpc-shared PRIVATE MINIUPNP_EXPORTS)
|
||||
|
@ -219,6 +222,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 +242,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
|
||||
|
|
|
@ -3,7 +3,7 @@
|
|||
# http://miniupnp.free.fr/
|
||||
# https://miniupnp.tuxfamily.org/
|
||||
# https://github.com/miniupnp/miniupnp
|
||||
# (c) 2005-2021 Thomas Bernard
|
||||
# (c) 2005-2022 Thomas Bernard
|
||||
# to install use :
|
||||
# $ make DESTDIR=/tmp/dummylocation install
|
||||
# or
|
||||
|
@ -293,6 +293,7 @@ $(BUILD)/miniupnpc.pc: VERSION
|
|||
echo "" >> $@
|
||||
echo "Name: miniUPnPc" >> $@
|
||||
echo "Description: UPnP IGD client lightweight library" >> $@
|
||||
echo "URL: https://miniupnp.tuxfamily.org/" >> $@
|
||||
echo "Version: $(VERSION)" >> $@
|
||||
echo "Libs: -L\$${libdir} -lminiupnpc" >> $@
|
||||
echo "Cflags: -I\$${includedir}" >> $@
|
||||
|
|
|
@ -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: @PROJECT_DESCRIPTION@
|
||||
URL: @PROJECT_HOMEPAGE_URL@
|
||||
Version: @PROJECT_VERSION@
|
||||
Libs: -L"${libdir}" -lminiupnpc
|
||||
Cflags: -I"${includedir}"
|
Loading…
Reference in New Issue