|
Added
Link Here
|
| 1 |
--- cmake/modules/FindInotify.cmake.orig 2021-10-13 14:58:23 UTC |
| 2 |
+++ cmake/modules/FindInotify.cmake |
| 3 |
@@ -0,0 +1,61 @@ |
| 4 |
+# SPDX-FileCopyrightText: 2016 Tobias C. Berner <tcberner@FreeBSD.org> |
| 5 |
+# SPDX-FileCopyrightText: 2017 Adriaan de Groot <groot@kde.org> |
| 6 |
+# |
| 7 |
+# SPDX-License-Identifier: BSD-2-Clause |
| 8 |
+ |
| 9 |
+#[=======================================================================[.rst: |
| 10 |
+FindInotify |
| 11 |
+-------------- |
| 12 |
+ |
| 13 |
+Try to find inotify on this system. This finds: |
| 14 |
+ - libinotify on Unix like systems, or |
| 15 |
+ - the kernel's inotify on Linux systems. |
| 16 |
+ |
| 17 |
+This will define the following variables: |
| 18 |
+ |
| 19 |
+``Inotify_FOUND`` |
| 20 |
+ True if inotify is available |
| 21 |
+``Inotify_LIBRARIES`` |
| 22 |
+ This has to be passed to target_link_libraries() |
| 23 |
+``Inotify_INCLUDE_DIRS`` |
| 24 |
+ This has to be passed to target_include_directories() |
| 25 |
+ |
| 26 |
+On Linux, the libraries and include directories are empty, |
| 27 |
+even though ``Inotify_FOUND`` may be set to TRUE. This is because |
| 28 |
+no special includes or libraries are needed. On other systems |
| 29 |
+these may be needed to use inotify. |
| 30 |
+ |
| 31 |
+Since 5.32.0. |
| 32 |
+#]=======================================================================] |
| 33 |
+ |
| 34 |
+find_path(Inotify_INCLUDE_DIRS sys/inotify.h) |
| 35 |
+ |
| 36 |
+if(Inotify_INCLUDE_DIRS) |
| 37 |
+# On Linux there is no library to link against, on the BSDs there is. |
| 38 |
+# On the BSD's, inotify is implemented through a library, libinotify. |
| 39 |
+ if( CMAKE_SYSTEM_NAME MATCHES "Linux") |
| 40 |
+ set(Inotify_FOUND TRUE) |
| 41 |
+ set(Inotify_LIBRARIES "") |
| 42 |
+ set(Inotify_INCLUDE_DIRS "") |
| 43 |
+ else() |
| 44 |
+ find_library(Inotify_LIBRARIES NAMES inotify) |
| 45 |
+ include(FindPackageHandleStandardArgs) |
| 46 |
+ find_package_handle_standard_args(Inotify |
| 47 |
+ FOUND_VAR |
| 48 |
+ Inotify_FOUND |
| 49 |
+ REQUIRED_VARS |
| 50 |
+ Inotify_LIBRARIES |
| 51 |
+ Inotify_INCLUDE_DIRS |
| 52 |
+ ) |
| 53 |
+ mark_as_advanced(Inotify_LIBRARIES Inotify_INCLUDE_DIRS) |
| 54 |
+ include(FeatureSummary) |
| 55 |
+ set_package_properties(Inotify PROPERTIES |
| 56 |
+ URL "https://github.com/libinotify-kqueue/" |
| 57 |
+ DESCRIPTION "inotify API on the *BSD family of operating systems." |
| 58 |
+ ) |
| 59 |
+ endif() |
| 60 |
+else() |
| 61 |
+ set(Inotify_FOUND FALSE) |
| 62 |
+endif() |
| 63 |
+ |
| 64 |
+mark_as_advanced(Inotify_LIBRARIES Inotify_INCLUDE_DIRS) |