File: FindInotify.cmake

package info (click to toggle)
syslog-ng 4.8.1-6
  • links: PTS, VCS
  • area: main
  • in suites: forky, sid
  • size: 20,456 kB
  • sloc: ansic: 177,631; python: 13,035; cpp: 11,611; makefile: 7,012; sh: 5,147; java: 3,651; xml: 3,344; yacc: 1,377; lex: 599; perl: 193; awk: 190; objc: 162
file content (84 lines) | stat: -rw-r--r-- 3,596 bytes parent folder | download | duplicates (2)
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
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
#.rest:
# FindInotify
# --------------
#
# Try to find inotify on this system. This finds:
#  - libinotiy on Unix like systems, or 
#  - the kernel's inotify on Linux systems.
#
# This will define the following variables:
#
# ``Inotify_FOUND``
#    True if inotify is available
# ``Inotify_LIBRARIES``
#    This has to be passed to target_link_libraries()
# ``Inotify_INCLUDE_DIRS``
#    This has to be passed to target_include_directories()
#
# On Linux, the libraries and include directories are empty,
# even though Inotify_FOUND may be set to TRUE. This is because
# no special includes or libraries are needed. On other systems
# these may be needed to use inotify.

#=============================================================================
# Copyright 2016 Tobias C. Berner <tcberner@FreeBSD.org>
# Copyright 2017 Adriaan de Groot <groot@kde.org>
#
# Redistribution and use in source and binary forms, with or without
# modification, are permitted provided that the following conditions
# are met:
#
# 1. Redistributions of source code must retain the copyright
#    notice, this list of conditions and the following disclaimer.
# 2. Redistributions in binary form must reproduce the copyright
#    notice, this list of conditions and the following disclaimer in the
#    documentation and/or other materials provided with the distribution.
#
# THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
# IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
# OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
# IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
# INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
# NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
# DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
# THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
# (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
# THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
#=============================================================================

set(Inotify_FOUND FALSE)

find_path (Inotify_INCLUDE_DIRS sys/inotify.h)
if (Inotify_INCLUDE_DIRS)
    if (CMAKE_SYSTEM_NAME MATCHES "Linux")
        # On Linux there is no library to link against, on the BSDs there is.
        set(Inotify_FOUND TRUE)

        set(Inotify_INCLUDE_DIRS "")
    #else()
        # On the BSD's, inotify is implemented through a library, libinotify.
        # But we disabled that for now because
        #   - Ivykis currently supports inotify only for directory monitoring, not for files
        #   - libinotify is just a wrapper around kqueue, why would we want a wrapper around
        #     a natively supported solution, instead of using it directly
        # https://github.com/buytenh/ivykis/issues/37

        #find_library(Inotify_LIBRARIES NAMES inotify)
        #include(FindPackageHandleStandardArgs)
        #find_package_handle_standard_args(Inotify
        #    FOUND_VAR
        #        Inotify_FOUND
        #    REQUIRED_VARS
        #        Inotify_LIBRARIES
        #        Inotify_INCLUDE_DIRS
        #)
        #mark_as_advanced(Inotify_LIBRARIES Inotify_INCLUDE_DIRS)
        #include(FeatureSummary)
        #set_package_properties(Inotify PROPERTIES
        #    URL "https://github.com/libinotify-kqueue/"
        #    DESCRIPTION "inotify API on the *BSD family of operating systems."
        #)
    endif()
endif()

mark_as_advanced(Inotify_LIBRARIES Inotify_INCLUDE_DIRS)