From 4f18afab6af6be1b5074a87de300f0ee02fad2a1 Mon Sep 17 00:00:00 2001 From: Marco Thaller Date: Mon, 11 Nov 2024 21:10:33 +0100 Subject: [PATCH] Allow to build KDMqtt on macOS * adapt FindMosquitto.cmake for macOS * (re)enable macOS CI run --- .github/workflows/build.yml | 8 +++++++- cmake/FindMosquitto.cmake | 6 ++++-- 2 files changed, 11 insertions(+), 3 deletions(-) diff --git a/.github/workflows/build.yml b/.github/workflows/build.yml index 6e0eb57..8aa843d 100644 --- a/.github/workflows/build.yml +++ b/.github/workflows/build.yml @@ -18,7 +18,7 @@ jobs: #- ubuntu-20.04 -> disabled during introduction of KDMqtt - windows-2022 #- windows-2019 - #- macos-12 -> disabled during introduction of KDMqtt + - macos-12 #- macos-11 build_type: - Debug @@ -50,6 +50,12 @@ jobs: libwayland-dev xvfb ninja-build \ libmosquittopp-dev + - name: Download mosquitto (MacOS) + if: runner.os == 'macOS' + run: | + brew update + brew install mosquitto + - name: Download mosquitto (Windows) if: runner.os == 'Windows' run: | diff --git a/cmake/FindMosquitto.cmake b/cmake/FindMosquitto.cmake index 01cbb11..aa7e3e9 100644 --- a/cmake/FindMosquitto.cmake +++ b/cmake/FindMosquitto.cmake @@ -14,17 +14,19 @@ find_file(MOSQUITTO_HEADER PATHS /usr/include /usr/local/include + /usr/local/opt/mosquitto/include $ENV{PROGRAMFILES}/mosquitto/devel $ENV{PROGRAMFILES\(X86\)}/mosquitto/devel ) -if(UNIX) +if(APPLE OR UNIX) find_library(MOSQUITTO_LIBRARY NAMES mosquitto PATHS /usr/lib /usr/local/lib + /usr/local/opt/mosquitto/lib ) if(MOSQUITTO_HEADER AND MOSQUITTO_LIBRARY) @@ -64,7 +66,7 @@ if(Mosquitto_FOUND) add_library(Mosquitto::Mosquitto SHARED IMPORTED) - if(UNIX) + if(APPLE OR UNIX) set_target_properties(Mosquitto::Mosquitto PROPERTIES IMPORTED_LOCATION "${MOSQUITTO_LIBRARY}" INTERFACE_INCLUDE_DIRECTORIES "${MOSQUITTO_INCLUDE_DIRECTORY}"