From 2dad5357405ad33cfa792f04b3ab62a5d188841e Mon Sep 17 00:00:00 2001 From: Daniel Baumann Date: Sat, 27 Apr 2024 19:06:32 +0200 Subject: Adding upstream version 1.4.34+dfsg. Signed-off-by: Daniel Baumann --- cmake/FindAvahi.cmake | 68 +++++++++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 68 insertions(+) create mode 100644 cmake/FindAvahi.cmake (limited to 'cmake/FindAvahi.cmake') diff --git a/cmake/FindAvahi.cmake b/cmake/FindAvahi.cmake new file mode 100644 index 0000000..b3d05b2 --- /dev/null +++ b/cmake/FindAvahi.cmake @@ -0,0 +1,68 @@ +# Try to find the Avahi libraries and headers +# Once done this will define: +# +# AVAHI_FOUND - system has the avahi libraries +# AVAHI_INCLUDE_DIRS - the avahi include directories +# AVAHI_LIBRARIES - The libraries needed to use avahi + +# use pkg-config to get the directories and then use these values +# in the find_path() and find_library() calls +find_package(PkgConfig) + +if(PKG_CONFIG_FOUND) + pkg_check_modules(_AVAHI avahi-client) +endif(PKG_CONFIG_FOUND) + +find_library(AVAHI_COMMON_LIB NAMES avahi-common + PATHS + ${_AVAHI_LIBRARY_DIRS} + ${COMMON_LIB_DIR} +) + +find_library(AVAHI_CLIENT_LIB NAMES avahi-client + PATHS + ${_AVAHI_LIBRARY_DIRS} + ${CLIENT_LIB_DIR} +) + +find_library(AVAHI_UI_LIB NAMES avahi-ui-gtk3 + PATHS + ${_AVAHI_LIBRARY_DIRS} + ${UI_LIB_DIR} +) + + +if(AVAHI_COMMON_LIB AND AVAHI_CLIENT_LIB AND AVAHI_UI_LIB) + set(AVAHI_LIBRARIES ${AVAHI_COMMON_LIB} ${AVAHI_CLIENT_LIB} ${AVAHI_UI_LIB}) + message(STATUS "Avahi-Libs found: ${AVAHI_LIBRARIES}") +endif() + +find_path(COMMON_INCLUDE_DIR watch.h + PATH_SUFFIXES avahi-common + PATHS + ${_AVAHI_INCLUDE_DIRS} + ${COMMON_INCLUDE_DIR} +) + +find_path(CLIENT_INCLUDE_DIR client.h + PATH_SUFFIXES avahi-client + PATHS + ${_AVAHI_INCLUDE_DIRS} + ${CLIENT_INCLUDE_DIR} +) + +find_path(UI_INCLUDE_DIR avahi-ui.h + PATH_SUFFIXES avahi-ui + PATHS + ${_AVAHI_INCLUDE_DIRS} + ${UI_INCLUDE_DIR} +) + +if(COMMON_INCLUDE_DIR AND CLIENT_INCLUDE_DIR AND UI_INCLUDE_DIR) + set(AVAHI_INCLUDE_DIRS ${COMMON_INCLUDE_DIR} ${CLIENT_INCLUDE_DIR} ${UI_INCLUDE_DIR}) + message(STATUS "Avahi-Include-Dirs found: ${AVAHI_INCLUDE_DIRS}") +endif() + +if(AVAHI_LIBRARIES AND AVAHI_INCLUDE_DIRS) + set(AVAHI_FOUND TRUE) +endif() -- cgit v1.2.3