Add pkg-config files to CMake build (#213)

This patch adds pkg-config files for libmosquitto and libmosquittopp,
and installs them through CMake.

Refs #107

Signed-off-by: Simon Marchi <simon.marchi@polymtl.ca>
This commit is contained in:
Simon Marchi 2016-09-10 16:48:50 -04:00 committed by Roger Light
parent 374c62586e
commit 97bfa506db
3 changed files with 32 additions and 0 deletions

View File

@ -32,6 +32,7 @@ if (WIN32)
set (DATAROOTDIR share)
set (MANDIR man)
set (SHAREDEST .)
set (PKGCONFIGDIR "${LIBDIR}/pkgconfig")
add_definitions("-D_CRT_SECURE_NO_WARNINGS")
add_definitions("-D_CRT_NONSTDC_NO_DEPRECATE")
else (WIN32)
@ -49,6 +50,7 @@ else (WIN32)
set (DATAROOTDIR share)
set (MANDIR "${DATAROOTDIR}/man")
set (SHAREDIR "${DATAROOTDIR}/mosquitto")
set (PKGCONFIGDIR "${LIBDIR}/pkgconfig")
endif (WIN32)
option(WITH_TLS
@ -98,6 +100,16 @@ endif (${DOCUMENTATION} STREQUAL ON)
install(FILES mosquitto.conf aclfile.example pskfile.example pwfile.example DESTINATION "${SYSCONFDIR}")
# ========================================
# Install pkg-config files
# ========================================
configure_file(libmosquitto.pc.in libmosquitto.pc @ONLY)
install(FILES "${CMAKE_CURRENT_BINARY_DIR}/libmosquitto.pc" DESTINATION "${PKGCONFIGDIR}")
configure_file(libmosquittopp.pc.in libmosquittopp.pc @ONLY)
install(FILES "${CMAKE_CURRENT_BINARY_DIR}/libmosquittopp.pc" DESTINATION "${PKGCONFIGDIR}")
# ========================================
# Testing
# ========================================

10
libmosquitto.pc.in Normal file
View File

@ -0,0 +1,10 @@
prefix=@CMAKE_INSTALL_PREFIX@
exec_prefix=${prefix}
includedir=${prefix}/include
libdir=${exec_prefix}/lib
Name: mosquitto
Description: mosquitto MQTT library (C bindings)
Version: @VERSION@
Cflags: -I${includedir}
Libs: -L${libdir} -lmosquitto

10
libmosquittopp.pc.in Normal file
View File

@ -0,0 +1,10 @@
prefix=@CMAKE_INSTALL_PREFIX@
exec_prefix=${prefix}
includedir=${prefix}/include
libdir=${exec_prefix}/lib
Name: mosquittopp
Description: mosquitto MQTT library (C++ bindings)
Version: @VERSION@
Cflags: -I${includedir}
Libs: -L${libdir} -lmosquittopp