150
|
1 include(CheckIncludeFiles)
|
|
2
|
|
3 set(LLVM_LINK_COMPONENTS support)
|
|
4
|
|
5 set(DIRECTORY_WATCHER_SOURCES DirectoryScanner.cpp)
|
|
6 set(DIRECTORY_WATCHER_LINK_LIBS "")
|
|
7
|
|
8 if(APPLE)
|
|
9 check_include_files("CoreServices/CoreServices.h" HAVE_CORESERVICES)
|
|
10 if(HAVE_CORESERVICES)
|
|
11 list(APPEND DIRECTORY_WATCHER_SOURCES mac/DirectoryWatcher-mac.cpp)
|
|
12 set(DIRECTORY_WATCHER_LINK_LIBS "-framework CoreServices")
|
|
13 endif()
|
|
14 elseif(CMAKE_SYSTEM_NAME MATCHES "Linux")
|
|
15 check_include_files("sys/inotify.h" HAVE_INOTIFY)
|
|
16 if(HAVE_INOTIFY)
|
|
17 list(APPEND DIRECTORY_WATCHER_SOURCES linux/DirectoryWatcher-linux.cpp)
|
|
18 find_package(Threads REQUIRED)
|
|
19 endif()
|
|
20 elseif(CMAKE_SYSTEM_NAME MATCHES "Windows")
|
|
21 list(APPEND DIRECTORY_WATCHER_SOURCES windows/DirectoryWatcher-windows.cpp)
|
|
22 else()
|
|
23 list(APPEND DIRECTORY_WATCHER_SOURCES default/DirectoryWatcher-not-implemented.cpp)
|
|
24 endif()
|
|
25
|
|
26 add_clang_library(clangDirectoryWatcher
|
|
27 ${DIRECTORY_WATCHER_SOURCES}
|
|
28 )
|
|
29
|
|
30 target_link_libraries(clangDirectoryWatcher PUBLIC ${CMAKE_THREAD_LIBS_INIT})
|
|
31 target_link_libraries(clangDirectoryWatcher PRIVATE ${DIRECTORY_WATCHER_LINK_LIBS})
|