diff --git a/cmake/modules/FindINotify.cmake b/cmake/modules/FindINotify.cmake index ca9f3889b0..19f43aa70c 100644 --- a/cmake/modules/FindINotify.cmake +++ b/cmake/modules/FindINotify.cmake @@ -4,20 +4,27 @@ # This module defines # INOTIFY_INCLUDE_DIR, where to find inotify.h, etc. +# INOTIFY_LIBRARY_DIR, the directory holding the inotify library. # INOTIFY_FOUND, If false, do not try to use inotify. # also defined, but not for general use are # INOTIFY_LIBRARY, where to find the inotify library. find_path(INOTIFY_INCLUDE_DIR sys/inotify.h - HINTS /usr/include/${CMAKE_LIBRARY_ARCHITECTURE}) + PATH_SUFFIXES inotify) mark_as_advanced(INOTIFY_INCLUDE_DIR) +find_library(INOTIFY_LIBRARY inotify PATH_SUFFIXES lib/inotify) + +get_filename_component(INOTIFY_LIBRARY_DIR ${INOTIFY_LIBRARY} DIRECTORY) +mark_as_advanced(INOTIFY_LIBRARY_DIR) + # all listed variables are TRUE # handle the QUIETLY and REQUIRED arguments and set INOTIFY_FOUND to TRUE if include(FindPackageHandleStandardArgs) -find_package_handle_standard_args(INOTIFY DEFAULT_MSG INOTIFY_INCLUDE_DIR) +find_package_handle_standard_args(INOTIFY DEFAULT_MSG INOTIFY_INCLUDE_DIR INOTIFY_LIBRARY_DIR) IF(INOTIFY_FOUND) SET(INotify_INCLUDE_DIRS ${INOTIFY_INCLUDE_DIR}) + SET(INotify_LIBRARY_DIRS ${INOTIFY_LIBRARY_DIR}) ENDIF(INOTIFY_FOUND) diff --git a/src/libsync/CMakeLists.txt b/src/libsync/CMakeLists.txt index 509b4825e8..26b012ca98 100644 --- a/src/libsync/CMakeLists.txt +++ b/src/libsync/CMakeLists.txt @@ -22,11 +22,11 @@ if ( APPLE ) ) endif() -IF(${CMAKE_SYSTEM_NAME} MATCHES "FreeBSD" OR ${CMAKE_SYSTEM_NAME} MATCHES "NetBSD") +IF(${CMAKE_SYSTEM_NAME} MATCHES "FreeBSD|NetBSD|OpenBSD") list(APPEND OS_SPECIFIC_LINK_LIBRARIES inotify ) -ENDIF(${CMAKE_SYSTEM_NAME} MATCHES "FreeBSD" OR ${CMAKE_SYSTEM_NAME} MATCHES "NetBSD") +ENDIF(${CMAKE_SYSTEM_NAME} MATCHES "FreeBSD|NetBSD|OpenBSD") if(SPARKLE_FOUND AND NOT BUILD_LIBRARIES_ONLY) list (APPEND OS_SPECIFIC_LINK_LIBRARIES ${SPARKLE_LIBRARY}) @@ -119,6 +119,11 @@ if(QTKEYCHAIN_FOUND OR QT5KEYCHAIN_FOUND) include_directories(${QTKEYCHAIN_INCLUDE_DIR}) endif() +if(INOTIFY_FOUND) + include_directories(${INOTIFY_INCLUDE_DIR}) + link_directories(${INOTIFY_LIBRARY_DIR}) +endif() + if(NEON_FOUND) list(APPEND libsync_LINK_TARGETS ${NEON_LIBRARIES} httpbf) include_directories(${NEON_INCLUDE_DIRS}) @@ -157,6 +162,10 @@ set_target_properties( ${synclib_NAME} PROPERTIES target_link_libraries(${synclib_NAME} ${libsync_LINK_TARGETS} ) +if(INOTIFY_FOUND) + target_link_libraries(${synclib_NAME} ${INOTIFY_LIBRARY} ) +endif() + if(BUILD_LIBRARIES_ONLY) #add_library(${synclib_NAME}_static STATIC ${libsync_SRCS} ${syncMoc}) #qt5_use_modules(${synclib_NAME}_static Widgets Network Xml Sql) diff --git a/src/libsync/utility.cpp b/src/libsync/utility.cpp index 91963071ba..9504ca7885 100644 --- a/src/libsync/utility.cpp +++ b/src/libsync/utility.cpp @@ -182,7 +182,7 @@ void Utility::setLaunchOnStartup(const QString &appName, const QString& guiName, qint64 Utility::freeDiskSpace(const QString &path, bool *ok) { -#if defined(Q_OS_MAC) || defined(Q_OS_FREEBSD) || defined(Q_OS_FREEBSD_KERNEL) || defined(Q_OS_NETBSD) +#if defined(Q_OS_MAC) || defined(Q_OS_FREEBSD) || defined(Q_OS_FREEBSD_KERNEL) || defined(Q_OS_NETBSD) || defined(Q_OS_OPENBSD) Q_UNUSED(ok) struct statvfs stat; statvfs(path.toUtf8().data(), &stat); @@ -379,7 +379,7 @@ bool Utility::isLinux() bool Utility::isBSD() { -#if defined(Q_OS_FREEBSD) || defined(Q_OS_NETBSD) +#if defined(Q_OS_FREEBSD) || defined(Q_OS_NETBSD) || defined(Q_OS_OPENBSD) return true; #else return false;