Welcome to mirror list, hosted at ThFree Co, Russian Federation.

FindAvahi.cmake « cmake - gitlab.com/Remmina/Remmina.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
blob: b3d05b23068dcd5b292f60960167eefad5c59f08 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
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()