1 include(CheckIncludeFiles)
3 set(LLVM_LINK_COMPONENTS support)
5 set(DIRECTORY_WATCHER_SOURCES DirectoryScanner.cpp)
6 set(DIRECTORY_WATCHER_LINK_LIBS "")
9 check_include_files("CoreServices/CoreServices.h" HAVE_CORESERVICES)
11 list(APPEND DIRECTORY_WATCHER_SOURCES mac/DirectoryWatcher-mac.cpp)
12 set(DIRECTORY_WATCHER_LINK_LIBS "-framework CoreServices")
14 elseif(CMAKE_SYSTEM_NAME MATCHES "Linux")
15 check_include_files("sys/inotify.h" HAVE_INOTIFY)
17 list(APPEND DIRECTORY_WATCHER_SOURCES linux/DirectoryWatcher-linux.cpp)
18 find_package(Threads REQUIRED)
20 elseif(CMAKE_SYSTEM_NAME MATCHES "Windows")
21 list(APPEND DIRECTORY_WATCHER_SOURCES windows/DirectoryWatcher-windows.cpp)
23 list(APPEND DIRECTORY_WATCHER_SOURCES default/DirectoryWatcher-not-implemented.cpp)
26 add_clang_library(clangDirectoryWatcher
27 ${DIRECTORY_WATCHER_SOURCES}
30 target_link_libraries(clangDirectoryWatcher PUBLIC ${CMAKE_THREAD_LIBS_INIT})
31 target_link_libraries(clangDirectoryWatcher PRIVATE ${DIRECTORY_WATCHER_LINK_LIBS})