source: CMakeModules/FindAvahi.cmake@ 12764

Last change on this file since 12764 was 10700, checked in by Michael Tänzer, 12 years ago

Merge CMake branch into trunk

File size: 3.7 KB
Line 
1# - Find Avahi
2# Find the Avahi library
3#
4# AVAHI_INCLUDE_DIRS - where to find the header files
5# AVAHI_LIBRARIES - List of libraries when using Avahi.
6# AVAHI_FOUND - True if Avahi was found.
7
8
9# [License]
10# The Ariba-Underlay Copyright
11#
12# Copyright (c) 2008-2012, Institute of Telematics, UniversitÀt Karlsruhe (TH)
13#
14# Institute of Telematics
15# UniversitÀt Karlsruhe (TH)
16# Zirkel 2, 76128 Karlsruhe
17# Germany
18#
19# Redistribution and use in source and binary forms, with or without
20# modification, are permitted provided that the following conditions are
21# met:
22#
23# 1. Redistributions of source code must retain the above copyright
24# notice, this list of conditions and the following disclaimer.
25# 2. Redistributions in binary form must reproduce the above copyright
26# notice, this list of conditions and the following disclaimer in the
27# documentation and/or other materials provided with the distribution.
28#
29# THIS SOFTWARE IS PROVIDED BY THE INSTITUTE OF TELEMATICS ``AS IS'' AND
30# ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
31# IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
32# PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE INSTITUTE OF TELEMATICS OR
33# CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
34# EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
35# PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
36# PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF
37# LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING
38# NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
39# SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
40#
41# The views and conclusions contained in the software and documentation
42# are those of the authors and should not be interpreted as representing
43# official policies, either expressed or implied, of the Institute of
44# Telematics.
45# [License]
46
47unset(handle_standard_args_variables)
48
49foreach(COMPONENT ${Avahi_FIND_COMPONENTS})
50 # Look for the header files.
51 find_path(Avahi_${COMPONENT}_INCLUDE_DIR NAMES "avahi-${COMPONENT}/")
52 mark_as_advanced(Avahi_${COMPONENT}_INCLUDE_DIR)
53
54 # Look for the library.
55 find_library(Avahi_${COMPONENT}_LIBRARY NAMES "avahi-${COMPONENT}"
56 DOC "The path to the ${COMPONENT} component of the Avahi library"
57 )
58 mark_as_advanced(Avahi_${COMPONENT}_LIBRARY)
59
60 list(APPEND handle_standard_args_variables
61 "Avahi_${COMPONENT}_INCLUDE_DIR"
62 "Avahi_${COMPONENT}_LIBRARY"
63 )
64
65endforeach(COMPONENT ${Avahi_FIND_COMPONENTS})
66
67
68# handle the QUIETLY and REQUIRED arguments and set LIBBLUETOOTH_FOUND to TRUE
69# if all listed variables are TRUE
70find_package(PackageHandleStandardArgs)
71find_package_handle_standard_args(Avahi DEFAULT_MSG
72 ${handle_standard_args_variables}
73 )
74
75
76if(AVAHI_FOUND)
77 foreach(COMPONENT ${Avahi_FIND_COMPONENTS})
78 list(APPEND AVAHI_LIBRARIES "${Avahi_${COMPONENT}_LIBRARY}")
79 list(APPEND AVAHI_INCLUDE_DIRS "${Avahi_${COMPONENT}_INCLUDE_DIR}")
80 endforeach(COMPONENT ${Avahi_FIND_COMPONENTS})
81
82 list(REMOVE_DUPLICATES AVAHI_INCLUDE_DIRS)
83
84
85 # Add dependencies for client
86 # TODO: handle dependencies of other parts
87 list(FIND Avahi_FIND_COMPONENTS client Avahi_FIND_COMPONENT_CLIENT)
88 if(Avahi_FIND_COMPONENT_CLIENT GREATER -1)
89 find_package(DBus ${Avahi_FIND_REQUIRED} ${Avahi_FIND_QUIETLY})
90 if(DBUS_FOUND)
91 list(APPEND AVAHI_LIBRARIES ${DBUS_LIBRARIES})
92 else()
93 message(WARNING "Could not find the D-Bus interprocess messaging "
94 "library which is a dependency of Avahi "
95 "=> static linking might fail")
96 endif()
97 endif()
98
99endif()
Note: See TracBrowser for help on using the repository browser.