Changeset View
Changeset View
Standalone View
Standalone View
devel/kf5-extra-cmake-modules/files/patch-git_add_FindInotify.cmake
- This file was moved from devel/kf5-extra-cmake-modules/files/patch-git_add_FindLibinotify.cmake.
Import FindLibinotify.cmake from https//git.reviewboard.kde.org/r/129316/ | From 8dab9b3f336ba889f9a750676cb7937ac6fc775d Mon Sep 17 00:00:00 2001 | ||||
From: Adriaan de Groot <groot@kde.org> | |||||
Date: Tue, 27 Dec 2016 21:05:50 +0100 | |||||
Subject: [PATCH] Detect inotify. | |||||
From 2da80872431a9dc169085a9edca8c79c49e7fade Mon Sep 17 00:00:00 2001 | Summary: | ||||
From: "Tobias C. Berner" <tcberner@gmail.com> | On Linux, inotify always exists; all you need is the header file. | ||||
Date: Sun, 30 Oct 2016 01:22:58 +0200 | On the BSDs, inotify is provided through a shim to kqueue, which | ||||
Subject: [PATCH] Add new cmake module `FindLibinotify.cmake`. | must be installed separately. Add a FindInotify to help sort | ||||
that out. | |||||
FreeBSD also has inotify. However it is a library and not a kernel subsystem. | Based on RB 129316 and RB 129549. | ||||
Test Plan: | |||||
- On FreeBSD, reliably detects presence of libinotify in $LOCALBASE, | |||||
- Needs testing on Linux that it does find the header file. | |||||
Reviewers: apol, tcberner, arrowdodger | |||||
Differential Revision: https://phabricator.kde.org/D3826 | |||||
--- | --- | ||||
find-modules/FindLibinotify.cmake | 71 +++++++++++++++++++++++++++++++++++++++ | find-modules/FindInotify.cmake | 76 ++++++++++++++++++++++++++++++++++++++++++ | ||||
1 file changed, 71 insertions(+) | 1 file changed, 76 insertions(+) | ||||
create mode 100644 find-modules/FindLibinotify.cmake | create mode 100644 find-modules/FindInotify.cmake | ||||
diff --git a/find-modules/FindLibinotify.cmake b/find-modules/FindLibinotify.cmake | diff --git a/find-modules/FindInotify.cmake b/find-modules/FindInotify.cmake | ||||
new file mode 100644 | new file mode 100644 | ||||
index 0000000..fe1f35e | index 0000000..41ef11f | ||||
--- /dev/null | --- /dev/null | ||||
+++ find-modules/FindLibinotify.cmake | +++ find-modules/FindInotify.cmake | ||||
@@ -0,0 +1,71 @@ | @@ -0,0 +1,76 @@ | ||||
+#.rest: | +#.rest: | ||||
+# FindLibinotify | +# FindInotify | ||||
+# -------------- | +# -------------- | ||||
+# | +# | ||||
+# Try to find libinotiy on Unix like systems. | +# 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: | +# This will define the following variables: | ||||
+# | +# | ||||
+# ``LIBINOTIFY_FOUND`` | +# ``Inotify_FOUND`` | ||||
+# True if Libinotify is available | +# True if inotify is available | ||||
+# ``LIBINOTIFY_LIBRARIES`` | +# ``Inotify_LIBRARIES`` | ||||
+# This has to be passed to target_link_libraries() | +# This has to be passed to target_link_libraries() | ||||
+# ``LIBINOTIFY_INCLUDE_DIRS`` | +# ``Inotify_INCLUDE_DIRS`` | ||||
+# This has to be passed to target_include_directories() | +# 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 2016 Tobias C. Berner <tcberner@FreeBSD.org> | ||||
+# | +# | ||||
+# Redistribution and use in source and binary forms, with or without | +# Redistribution and use in source and binary forms, with or without | ||||
+# modification, are permitted provided that the following conditions | +# modification, are permitted provided that the following conditions | ||||
+# are met: | +# are met: | ||||
+# | +# | ||||
+# 1. Redistributions of source code must retain the copyright | +# 1. Redistributions of source code must retain the copyright | ||||
+# notice, this list of conditions and the following disclaimer. | +# notice, this list of conditions and the following disclaimer. | ||||
+# 2. Redistributions in binary form must reproduce the copyright | +# 2. Redistributions in binary form must reproduce the copyright | ||||
+# notice, this list of conditions and the following disclaimer in the | +# notice, this list of conditions and the following disclaimer in the | ||||
+# documentation and/or other materials provided with the distribution. | +# documentation and/or other materials provided with the distribution. | ||||
+# 3. The name of the author may not be used to endorse or promote products | |||||
+# derived from this software without specific prior written permission. | |||||
+# | +# | ||||
+# THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR | +# THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR | ||||
+# IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES | +# IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES | ||||
+# OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. | +# OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. | ||||
+# IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT, | +# IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT, | ||||
+# INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT | +# INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT | ||||
+# NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, | +# NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, | ||||
+# DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY | +# DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY | ||||
+# THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT | +# THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT | ||||
+# (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF | +# (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF | ||||
+# THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. | +# THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. | ||||
+#============================================================================= | +#============================================================================= | ||||
+ | + | ||||
+find_path(LIBINOTIFY_INCLUDE_DIRS sys/inotify.h ) | +find_path(Inotify_INCLUDE_DIRS sys/inotify.h) | ||||
+ | + | ||||
+if ( LIBINOTIFY_INCLUDE_DIRS ) | +if(Inotify_INCLUDE_DIRS) | ||||
+ # On Linux there is no library to link against, on the BSDs there is. | + # On Linux there is no library to link against, on the BSDs there is. | ||||
+ # On the BSD's, inotify is implemented through a library, libinotify. | |||||
+ if ( CMAKE_SYSTEM_NAME MATCHES "Linux" ) | + if( CMAKE_SYSTEM_NAME MATCHES "Linux") | ||||
+ set( LIBINOTIFY_FOUND TRUE ) | + set(Inotify_FOUND TRUE) | ||||
+ else () | + else() | ||||
+ find_library( LIBINOTIFY_LIBRARIES NAMES inotify ) | + find_library(Inotify_LIBRARIES NAMES inotify) | ||||
+ include(FindPackageHandleStandardArgs) | + include(FindPackageHandleStandardArgs) | ||||
+ find_package_handle_standard_args( Libinotify | + find_package_handle_standard_args(Inotify | ||||
+ FOUND_VAR | + FOUND_VAR | ||||
+ LIBINOTIFY_FOUND | + Inotify_FOUND | ||||
+ REQUIRED_VARS | + REQUIRED_VARS | ||||
+ LIBINOTIFY_LIBRARIES | + Inotify_LIBRARIES | ||||
+ LIBINOTIFY_INCLUDE_DIRS | + Inotify_INCLUDE_DIRS | ||||
+ ) | + ) | ||||
+ mark_as_advanced( LIBINOTIFY_LIBRARIES LIBINOTIFY_INCLUDE_DIRS ) | + mark_as_advanced(Inotify_LIBRARIES Inotify_INCLUDE_DIRS) | ||||
+ include(FeatureSummary) | + include(FeatureSummary) | ||||
+ set_package_properties(Libinotify PROPERTIES | + set_package_properties(Inotify PROPERTIES | ||||
+ URL "https://github.com/dmatveev/libinotify-kqueue" | + URL "https://github.com/libinotify-kqueue/" | ||||
+ DESCRIPTION "inotify API on the *BSD family of operating systems." | + DESCRIPTION "inotify API on the *BSD family of operating systems." | ||||
+ ) | + ) | ||||
+ endif () | + endif() | ||||
+else () | +else() | ||||
+ set( LIBINOTIFY_FOUND FALSE ) | + set(Inotify_FOUND FALSE) | ||||
+endif () | +endif() | ||||
+ | + | ||||
+mark_as_advanced( LIBINOTIFY_FOUND ) | +mark_as_advanced(Inotify_FOUND) | ||||
-- | -- | ||||
2.10.1 | 2.9.2 | ||||