From 31fc8e5c72e189f36c6b8cad81a7159085cbe67c Mon Sep 17 00:00:00 2001 From: "David Kahles (KDV)" Date: Wed, 9 Mar 2022 13:14:33 +0100 Subject: [PATCH] Improve finding avahi-client Unfortunately, there is no FindAvahi.cmake file available. Instead use find_library and find_path to find the libavahi-client.so and avahi-client/client.h files. This improves logging if the files are not found and allows to use CMAKE_FIND_ROOT_PATH to alter the search paths for crossplatform builds. --- CMakeLists.txt | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/CMakeLists.txt b/CMakeLists.txt index ed87d29..b7add87 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -23,15 +23,18 @@ else() endif() if(${CMAKE_SYSTEM_NAME} STREQUAL "Linux") + find_library(avahi-client-lib avahi-client REQUIRED) + find_path(avahi-client-includes avahi-client/client.h REQUIRED) target_sources(QtZeroConf PRIVATE avahi-qt/qt-watch_p.h avahi-qt/qt-watch.cpp avahiclient.cpp ) + target_include_directories(QtZeroConf PRIVATE ${avahi-client-includes}) list(APPEND ${PUBLIC_HEADERS} avahi-qt/qt-watch.h ) - target_link_libraries(QtZeroConf PRIVATE avahi-client) + target_link_libraries(QtZeroConf PRIVATE ${avahi-client-lib}) endif() if(APPLE)