Detect inotify.
ClosedPublic

Authored by adridg on Dec 27 2016, 8:09 PM.

Details

Summary

On Linux, inotify always exists; all you need is the header file.
On the BSDs, inotify is provided through a shim to kqueue, which
must be installed separately. Add a FindInotify to help sort
that out.

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.

Diff Detail

Repository
R240 Extra CMake Modules
Branch
inotify
Lint
No Linters Available
Unit
No Unit Test Coverage
adridg updated this revision to Diff 9401.Dec 27 2016, 8:09 PM
adridg retitled this revision from to Detect inotify..
adridg updated this object.
adridg edited the test plan for this revision. (Show Details)
adridg added reviewers: apol, tcberner, arrowd.

Should Inotify_LIBRARIES and Inotify_INCLUDE_DIRS be set to empty strings after r54?

Should Inotify_LIBRARIES and Inotify_INCLUDE_DIRS be set to empty strings after r54?

ltoscano added a subscriber: Build System.
ltoscano removed a subscriber: Build System.
tcberner accepted this revision.Dec 28 2016, 7:28 PM
tcberner edited edge metadata.

Looks good to me, that is all the ports that depend on it, still find libinotify after modifying the patches to use this version.

find-modules/FindInotify.cmake
24 ↗(On Diff #9401)

You should add yourself here.

This revision is now accepted and ready to land.Dec 28 2016, 7:28 PM

Forgot to add Frameworks as reviewer in original review.

Adding Kevin as reviewer -- I feel uncomfortable having so little feedback and I'm not sure who should be added if #buildsystem and Frameworks don't ACK.

ervin edited edge metadata.

Not my forte, but I don't see anything blatantly wrong in here. Adding dfaure to see if he got something to say about it.

dfaure added inline comments.Jan 16 2017, 12:32 PM
find-modules/FindInotify.cmake
48 ↗(On Diff #9401)

What's the difference with check_include_files as used by kcoreaddons/CMakeLists.txt?

It seems to me that find_path won't know where to look, no, at least check_include_files seems much more appropriate for includes?

kfunk requested changes to this revision.Jan 16 2017, 12:42 PM
kfunk added a reviewer: kfunk.
kfunk added a subscriber: kfunk.
kfunk added inline comments.
find-modules/FindInotify.cmake
51 ↗(On Diff #9401)

Style: Indent off

54 ↗(On Diff #9401)

Set Inotify_LIBRARIES & Inotify_INCLUDE_DIRS to empty string?

76 ↗(On Diff #9401)

Inotify_LIBRARIES & Inotify_INCLUDE_DIRS should be marked as advanced instead

This revision now requires changes to proceed.Jan 16 2017, 12:42 PM

@dfaure find_path is okay here, it's commonly used for finding includes. See: https://cmake.org/cmake/help/v3.0/command/find_path.html

check_include_files is used for just checking the existence of a include, not finding out where it is.
Example use: CHECK_INCLUDE_FILES (malloc.h HAVE_MALLOC_H)

dfaure edited edge metadata.Jan 16 2017, 12:53 PM

OK I see. On Linux it was enough to check that the header is present (-> in /usr/include) while on BSD it's part of a library that could in theory be installed anywhere. Makes sense to set an _INCLUDE_DIRS variable then.

adridg updated this revision to Diff 10439.Jan 22 2017, 8:41 PM
adridg edited edge metadata.
  • Follow up on review
Restricted Application added projects: Frameworks, Build System. · View Herald TranscriptJan 22 2017, 8:41 PM
adridg marked 5 inline comments as done.Jan 22 2017, 8:44 PM
adridg added inline comments.
find-modules/FindInotify.cmake
51 ↗(On Diff #9401)

Assuming that means "comments indent 0" and not "comments indentation should match surrounding indent, which is 4". It's a bit ambiguous.

54 ↗(On Diff #9401)

Yes, good point -- since the instructions will be to add ${Inotify_INCLUDE_DIRS} to the include path, they must be set to avoid warnings.

kfunk accepted this revision.Feb 14 2017, 9:26 AM
kfunk edited edge metadata.
This revision is now accepted and ready to land.Feb 14 2017, 9:26 AM
This revision was automatically updated to reflect the committed changes.
adridg marked 2 inline comments as done.