Skip to content

Commit

Permalink
Add pkg-config files to CMake build (#213)
Browse files Browse the repository at this point in the history
This patch adds pkg-config files for libmosquitto and libmosquittopp,
and installs them through CMake.

Refs #107

Signed-off-by: Simon Marchi <[email protected]>
  • Loading branch information
simark authored and ralight committed Sep 10, 2016
1 parent 374c625 commit 97bfa50
Show file tree
Hide file tree
Showing 3 changed files with 32 additions and 0 deletions.
12 changes: 12 additions & 0 deletions CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -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)
Expand All @@ -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
Expand Down Expand Up @@ -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
# ========================================
Expand Down
10 changes: 10 additions & 0 deletions libmosquitto.pc.in
Original file line number Diff line number Diff line change
@@ -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 changes: 10 additions & 0 deletions libmosquittopp.pc.in
Original file line number Diff line number Diff line change
@@ -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

0 comments on commit 97bfa50

Please sign in to comment.