Permalink
Browse files

Add check for inotify.h and (optional) libinotify.so

  • Loading branch information...
1 parent 7761a65 commit 7b3e14ffb1f517dc369e96457df0cb0d7acec373 @sgolemon sgolemon committed Aug 18, 2012
Showing with 33 additions and 0 deletions.
  1. +23 −0 CMake/FindLibinotify.cmake
  2. +10 −0 CMake/HPHPFindLibs.cmake
View
@@ -0,0 +1,23 @@
+#
+# $Id$
+#
+# - Find libinotify
+# Find libinotify
+#
+# LIBINOTIFY_INCLUDE_DIR - where to find sys/inotify.h
+# LIBINOTIFY_LIBRARY - List of libraries when using libinotify
+# LIBINOTIFY_FOUND - True if libinotify found.
+
+
+if(LIBINOTIFY_INCLUDE_DIR)
+ # Already in cache, be silent
+ SET(LIBINOTIFY_FIND_QUIETLY TRUE)
+endif()
+
+FIND_PATH(LIBINOTIFY_INCLUDE_DIR sys/inotify.h)
+FIND_LIBRARY(LIBINOTIFY_LIBRARY inotify)
+
+INCLUDE(FindPackageHandleStandardArgs)
+FIND_PACKAGE_HANDLE_STANDARD_ARGS(LIBINOTIFY DEFAULT_MSG LIBINOTIFY_LIBRARY LIBINOTIFY_INCLUDE_DIR)
+
+MARK_AS_ADVANCED(LIBINOTIFY_LIBRARY LIBINOTIFY_INCLUDE_DIR)
View
@@ -28,6 +28,12 @@ endif()
include_directories(${Boost_INCLUDE_DIRS})
link_directories(${Boost_LIBRARY_DIRS})
+# inotify checks
+find_package(Libinotify)
+if (LIBINOTIFY_INCLUDE_DIR)
+ include_directories(${LIBINOTIFY_INCLUDE_DIR})
+endif()
+
# unwind checks
find_package(Libunwind REQUIRED)
include_directories(${LIBUNWIND_INCLUDE_DIR})
@@ -351,6 +357,10 @@ macro(hphp_link target)
target_link_libraries(${target} ${LIBEVENT_LIB})
target_link_libraries(${target} ${CURL_LIBRARIES})
+if (LIBINOTIFY_LIBRARY)
+ target_link_libraries(${target} ${LIBINOTIFY_LIBRARY})
+endif()
+
if (LINUX)
target_link_libraries(${target} ${CAP_LIB})
endif()

0 comments on commit 7b3e14f

Please sign in to comment.