diff options
Diffstat (limited to 'dep/efsw/CMakeLists.txt')
| -rw-r--r-- | dep/efsw/CMakeLists.txt | 211 |
1 files changed, 122 insertions, 89 deletions
diff --git a/dep/efsw/CMakeLists.txt b/dep/efsw/CMakeLists.txt index 555f1b303a0..aba29c55905 100644 --- a/dep/efsw/CMakeLists.txt +++ b/dep/efsw/CMakeLists.txt @@ -1,79 +1,116 @@ if (BUILD_SHARED_LIBS) - set(EFSW_CPP_SOURCE - src/efsw/Atomic.hpp - src/efsw/base.hpp - src/efsw/Debug.cpp - src/efsw/Debug.hpp - src/efsw/DirectorySnapshot.cpp - src/efsw/DirectorySnapshot.hpp - src/efsw/DirectorySnapshotDiff.cpp - src/efsw/DirectorySnapshotDiff.hpp - src/efsw/DirWatcherGeneric.cpp - src/efsw/DirWatcherGeneric.hpp - src/efsw/FileInfo.cpp - src/efsw/FileInfo.hpp - src/efsw/FileSystem.cpp - src/efsw/FileSystem.hpp - src/efsw/FileWatcher.cpp - src/efsw/FileWatcherCWrapper.cpp - src/efsw/FileWatcherGeneric.cpp - src/efsw/FileWatcherGeneric.hpp - src/efsw/FileWatcherImpl.cpp - src/efsw/FileWatcherImpl.hpp - src/efsw/Lock.hpp - src/efsw/Log.cpp - src/efsw/Mutex.hpp - src/efsw/sophist.h - src/efsw/String.cpp - src/efsw/String.hpp - src/efsw/System.cpp - src/efsw/System.hpp - src/efsw/Thread.hpp - src/efsw/Utf.hpp - src/efsw/Watcher.cpp - src/efsw/Watcher.hpp - src/efsw/WatcherGeneric.cpp - src/efsw/WatcherGeneric.hpp - src/efsw/platform/platformimpl.hpp - ) + add_library(efsw STATIC) - if (WIN32) - list (APPEND EFSW_CPP_SOURCE - src/efsw/platform/win/FileSystemImpl.cpp - src/efsw/platform/win/FileSystemImpl.hpp - src/efsw/platform/win/SystemImpl.cpp - src/efsw/platform/win/SystemImpl.hpp) - else () - list (APPEND EFSW_CPP_SOURCE - src/efsw/platform/posix/FileSystemImpl.cpp - src/efsw/platform/posix/FileSystemImpl.hpp - src/efsw/platform/posix/SystemImpl.cpp - src/efsw/platform/posix/SystemImpl.hpp) + if(WIN32) + set(efsw_platform_dir "win") + else() + set(efsw_platform_dir "posix") endif() + target_sources(efsw + PRIVATE + src/efsw/Debug.cpp + src/efsw/DirectorySnapshot.cpp + src/efsw/DirectorySnapshotDiff.cpp + src/efsw/DirWatcherGeneric.cpp + src/efsw/FileInfo.cpp + src/efsw/FileSystem.cpp + src/efsw/FileWatcher.cpp + src/efsw/FileWatcherCWrapper.cpp + src/efsw/FileWatcherGeneric.cpp + src/efsw/FileWatcherImpl.cpp + src/efsw/Log.cpp + src/efsw/String.cpp + src/efsw/System.cpp + src/efsw/Watcher.cpp + src/efsw/WatcherGeneric.cpp + src/efsw/platform/${efsw_platform_dir}/FileSystemImpl.cpp + src/efsw/platform/${efsw_platform_dir}/SystemImpl.cpp) + + target_sources(efsw + PUBLIC + FILE_SET HEADERS + BASE_DIRS include + FILES + include/efsw/efsw.h + include/efsw/efsw.hpp) + + target_sources(efsw + PRIVATE + FILE_SET efsw_private_headers + TYPE HEADERS + BASE_DIRS src + FILES + src/efsw/Atomic.hpp + src/efsw/base.hpp + src/efsw/Debug.hpp + src/efsw/DirectorySnapshot.hpp + src/efsw/DirectorySnapshotDiff.hpp + src/efsw/DirWatcherGeneric.hpp + src/efsw/FileInfo.hpp + src/efsw/FileSystem.hpp + src/efsw/FileWatcherGeneric.hpp + src/efsw/FileWatcherImpl.hpp + src/efsw/Lock.hpp + src/efsw/Mutex.hpp + src/efsw/sophist.h + src/efsw/String.hpp + src/efsw/System.hpp + src/efsw/Thread.hpp + src/efsw/Utf.hpp + src/efsw/Watcher.hpp + src/efsw/WatcherGeneric.hpp + src/efsw/platform/platformimpl.hpp + src/efsw/platform/${efsw_platform_dir}/FileSystemImpl.hpp + src/efsw/platform/${efsw_platform_dir}/SystemImpl.hpp) + if (APPLE) - list (APPEND EFSW_CPP_SOURCE - src/efsw/FileWatcherFSEvents.cpp - src/efsw/FileWatcherFSEvents.hpp - src/efsw/FileWatcherKqueue.cpp - src/efsw/FileWatcherKqueue.hpp - src/efsw/WatcherFSEvents.cpp - src/efsw/WatcherFSEvents.hpp - src/efsw/WatcherKqueue.cpp - src/efsw/WatcherKqueue.hpp) - set(OPTIONAL_LINK_LIBRARIES "-framework CoreFoundation" "-framework CoreServices") + target_sources(efsw + PRIVATE + src/efsw/FileWatcherFSEvents.cpp + src/efsw/FileWatcherKqueue.cpp + src/efsw/WatcherFSEvents.cpp + src/efsw/WatcherKqueue.cpp) + target_sources(efsw + PRIVATE + FILE_SET efsw_private_headers + TYPE HEADERS + BASE_DIRS src + FILES + src/efsw/FileWatcherFSEvents.hpp + src/efsw/FileWatcherKqueue.hpp + src/efsw/WatcherFSEvents.hpp + src/efsw/WatcherKqueue.hpp) + target_link_libraries(efsw + PRIVATE + $<LINK_LIBRARY:FRAMEWORK,CoreFoundation> + $<LINK_LIBRARY:FRAMEWORK,CoreServices>) elseif (WIN32) - list (APPEND EFSW_CPP_SOURCE - src/efsw/FileWatcherWin32.cpp - src/efsw/FileWatcherWin32.hpp - src/efsw/WatcherWin32.cpp - src/efsw/WatcherWin32.hpp) + target_sources(efsw + PRIVATE + src/efsw/FileWatcherWin32.cpp + src/efsw/WatcherWin32.cpp) + target_sources(efsw + PRIVATE + FILE_SET efsw_private_headers + TYPE HEADERS + BASE_DIRS src + FILES + src/efsw/FileWatcherWin32.hpp + src/efsw/WatcherWin32.hpp) elseif (${CMAKE_SYSTEM_NAME} MATCHES "Linux") - list (APPEND EFSW_CPP_SOURCE - src/efsw/FileWatcherInotify.cpp - src/efsw/FileWatcherInotify.hpp - src/efsw/WatcherInotify.cpp - src/efsw/WatcherInotify.hpp) + target_sources(efsw + PRIVATE + src/efsw/FileWatcherInotify.cpp + src/efsw/WatcherInotify.cpp) + target_sources(efsw + PRIVATE + FILE_SET efsw_private_headers + TYPE HEADERS + BASE_DIRS src + FILES + src/efsw/FileWatcherInotify.hpp + src/efsw/WatcherInotify.hpp) find_path(EFSW_INOTIFY_H NAMES sys/inotify.h @@ -83,34 +120,30 @@ if (BUILD_SHARED_LIBS) list (APPEND EFSW_CPP_SOURCE src/efsw/inotify-nosys.h ) - set(OPTIONAL_COMPILE_DEFINITIONS "-DEFSW_INOTIFY_NOSYS") + target_compile_definitions(efsw + PRIVATE + EFSW_INOTIFY_NOSYS) endif() elseif (${CMAKE_SYSTEM_NAME} MATCHES "FreeBSD") - list (APPEND EFSW_CPP_SOURCE - src/efsw/FileWatcherKqueue.cpp - src/efsw/FileWatcherKqueue.hpp - src/efsw/WatcherKqueue.cpp - src/efsw/WatcherKqueue.hpp) + target_sources(efsw + PRIVATE + src/efsw/FileWatcherKqueue.cpp + src/efsw/WatcherKqueue.cpp) + target_sources(efsw + PRIVATE + FILE_SET efsw_private_headers + TYPE HEADERS + BASE_DIRS src + FILES + src/efsw/FileWatcherKqueue.hpp + src/efsw/WatcherKqueue.hpp) endif() - add_library(efsw STATIC ${EFSW_CPP_SOURCE}) - - target_include_directories(efsw - PUBLIC - ${CMAKE_CURRENT_SOURCE_DIR}/include - PRIVATE - ${CMAKE_CURRENT_SOURCE_DIR}/src) - - target_compile_definitions(efsw - PRIVATE - ${OPTIONAL_COMPILE_DEFINITIONS}) - target_link_libraries(efsw PRIVATE trinity-dependency-interface PUBLIC - threads - ${OPTIONAL_LINK_LIBRARIES}) + threads) set_target_properties(efsw PROPERTIES |
