Skip to content

Commit

Permalink
Allow to build KDMqtt on macOS
Browse files Browse the repository at this point in the history
* adapt FindMosquitto.cmake for macOS
* (re)enable macOS CI run
  • Loading branch information
marcothaller committed Nov 11, 2024
1 parent 09f2ac2 commit 4f18afa
Show file tree
Hide file tree
Showing 2 changed files with 11 additions and 3 deletions.
8 changes: 7 additions & 1 deletion .github/workflows/build.yml
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down Expand Up @@ -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: |
Expand Down
6 changes: 4 additions & 2 deletions cmake/FindMosquitto.cmake
Original file line number Diff line number Diff line change
Expand Up @@ -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)
Expand Down Expand Up @@ -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}"
Expand Down

0 comments on commit 4f18afa

Please sign in to comment.