Find libmosquitto and ship it in release packages (iteration 2, step 1)

cmake/Mosquitto.cmake finds it through pkg-config; with
FRAMEASSISTANT_SHIP_MOSQUITTO=ON (all package presets) it installs
lib/libmosquitto.so.1 and Debian's copyright file and excludes the
library from the Qt bundler (D35). The build containers get
libmosquitto-dev, the test container the mosquitto broker.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
2026-10-06 14:44:20 +02:00
co-authored by Claude Opus 5.5
parent 7810db5cbe
commit e0229d6647
12 changed files with 74 additions and 6 deletions
+39
View File
@@ -0,0 +1,39 @@
# Provides the imported target PkgConfig::MOSQUITTO (libmosquitto, the MQTT client
# library; docs/DESIGN.md, D14/D35).
#
# Found through pkg-config (Debian: libmosquitto-dev, Arch: mosquitto). The Frame has no
# libmosquitto, so package builds ship it like libopenvr_api.so: with
# FRAMEASSISTANT_SHIP_MOSQUITTO=ON the library is installed into lib/ under its soname
# (found through RPATH $ORIGIN/../lib), together with Debian's copyright file.
option(FRAMEASSISTANT_SHIP_MOSQUITTO "Install libmosquitto into lib/ (package builds)" OFF)
find_package(PkgConfig REQUIRED)
pkg_check_modules(MOSQUITTO REQUIRED IMPORTED_TARGET libmosquitto)
message(STATUS "libmosquitto: ${MOSQUITTO_VERSION}")
if(FRAMEASSISTANT_SHIP_MOSQUITTO)
find_library(MOSQUITTO_LIBRARY NAMES mosquitto HINTS ${MOSQUITTO_LIBRARY_DIRS} REQUIRED)
get_filename_component(_mosquitto_dir ${MOSQUITTO_LIBRARY} DIRECTORY)
# The soname has been libmosquitto.so.1 since 1.x; the file behind it is versioned.
set(_mosquitto_soname libmosquitto.so.1)
if(NOT EXISTS ${_mosquitto_dir}/${_mosquitto_soname})
message(FATAL_ERROR "${_mosquitto_dir}/${_mosquitto_soname} not found")
endif()
file(REAL_PATH ${_mosquitto_dir}/${_mosquitto_soname} _mosquitto_file)
install(FILES ${_mosquitto_file} DESTINATION ${CMAKE_INSTALL_LIBDIR}
RENAME ${_mosquitto_soname})
# Debian's copyright file (same path for every architecture through multiarch).
set(_mosquitto_copyright /usr/share/doc/libmosquitto1/copyright)
if(EXISTS ${_mosquitto_copyright})
install(FILES ${_mosquitto_copyright}
DESTINATION ${CMAKE_INSTALL_DOCDIR}/third-party
RENAME libmosquitto1.copyright)
else()
message(WARNING "${_mosquitto_copyright} not found: package lacks libmosquitto's license")
endif()
# Shipped by the rule above: the Qt bundler must not copy it a second time.
list(APPEND VRDASH_BUNDLE_EXCLUDE "^libmosquitto")
endif()