From 97bfa506db0839f0746246ca6c647fc9e3dd826d Mon Sep 17 00:00:00 2001 From: Simon Marchi Date: Sat, 10 Sep 2016 16:48:50 -0400 Subject: [PATCH] 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 --- CMakeLists.txt | 12 ++++++++++++ libmosquitto.pc.in | 10 ++++++++++ libmosquittopp.pc.in | 10 ++++++++++ 3 files changed, 32 insertions(+) create mode 100644 libmosquitto.pc.in create mode 100644 libmosquittopp.pc.in diff --git a/CMakeLists.txt b/CMakeLists.txt index 6fe8a001..cc40bad6 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -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 # ======================================== diff --git a/libmosquitto.pc.in b/libmosquitto.pc.in new file mode 100644 index 00000000..101a125f --- /dev/null +++ b/libmosquitto.pc.in @@ -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 diff --git a/libmosquittopp.pc.in b/libmosquittopp.pc.in new file mode 100644 index 00000000..6070f44f --- /dev/null +++ b/libmosquittopp.pc.in @@ -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