From a755a86f316964f60d60c2b94791d5c91f3e4d73 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Adrian=20B=C3=B6ckenkamp?= Date: Tue, 5 Jul 2022 12:41:42 +0200 Subject: [PATCH 1/3] Fix compiler errors #if USE_BOOST_FILESYSTEM, and Boost < v1.72 --- src/Inotify.cpp | 4 ++++ src/include/inotify-cpp/FileSystemAdapter.h | 3 ++- 2 files changed, 6 insertions(+), 1 deletion(-) diff --git a/src/Inotify.cpp b/src/Inotify.cpp index 9c678a4..062cbb0 100644 --- a/src/Inotify.cpp +++ b/src/Inotify.cpp @@ -105,7 +105,11 @@ void Inotify::watchDirectoryRecursively(fs::path path) if (fs::is_directory(path)) { inotifypp::error_code ec; fs::recursive_directory_iterator it( + #if !defined USE_BOOST_FILESYSTEM || (defined USE_BOOST_FILESYSTEM && BOOST_VERSION >= 107200) path, fs::directory_options::follow_directory_symlink, ec); + #else + path, ec); + #endif fs::recursive_directory_iterator end; for (; it != end; it.increment(ec)) { diff --git a/src/include/inotify-cpp/FileSystemAdapter.h b/src/include/inotify-cpp/FileSystemAdapter.h index b3f7283..8383223 100644 --- a/src/include/inotify-cpp/FileSystemAdapter.h +++ b/src/include/inotify-cpp/FileSystemAdapter.h @@ -22,6 +22,7 @@ namespace inotifypp #include #include +#include namespace inotifypp { @@ -32,7 +33,7 @@ namespace inotifypp template using optional = boost::optional; - inline constexpr boost::none_t nullopt() { return boost::none; }; + inline boost::none_t nullopt() { return boost::none; }; } #endif From 8f517e3923d57ca9412a067ffe39b6415ce5ede5 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Adrian=20B=C3=B6ckenkamp?= Date: Tue, 5 Jul 2022 12:53:50 +0200 Subject: [PATCH 2/3] Add USE_BOOST_FILESYSTEM to INTERFACE library to make it avail to other targets --- CMakeLists.txt | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/CMakeLists.txt b/CMakeLists.txt index 7a73e09..5b1555f 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -23,7 +23,7 @@ find_package(Boost 1.54.0 COMPONENTS ${USED_BOOST_LIBS} REQUIRED) add_library(inotify-filesystem-adapter INTERFACE) if(CMAKE_CXX_STANDARD LESS 17 OR USE_BOOST_FILESYSTEM) - add_definitions(-DUSE_BOOST_FILESYSTEM) + target_compile_definitions(inotify-filesystem-adapter INTERFACE USE_BOOST_FILESYSTEM) target_link_libraries(inotify-filesystem-adapter INTERFACE Boost::filesystem) else() target_link_libraries(inotify-filesystem-adapter INTERFACE stdc++fs) From d355f10ac8fab0f38287015485550f0018c386f4 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Adrian=20B=C3=B6ckenkamp?= Date: Tue, 5 Jul 2022 13:00:44 +0200 Subject: [PATCH 3/3] Fix making USE_BOOST_FILESYSTEM avail to targets --- src/CMakeLists.txt | 3 +++ 1 file changed, 3 insertions(+) diff --git a/src/CMakeLists.txt b/src/CMakeLists.txt index cb64aea..ef2d648 100644 --- a/src/CMakeLists.txt +++ b/src/CMakeLists.txt @@ -35,6 +35,9 @@ macro(configure_target target) $ ${Boost_INCLUDE_DIR}) target_link_libraries(${target} PUBLIC inotify-filesystem-adapter) + if(CMAKE_CXX_STANDARD LESS 17 OR USE_BOOST_FILESYSTEM) + target_compile_definitions(${target} PUBLIC USE_BOOST_FILESYSTEM) + endif() endmacro(configure_target target)