inotify-cpp icon indicating copy to clipboard operation
inotify-cpp copied to clipboard

Requires at least Boost 1.72, compiler errors w/ USE_BOOST_FILESYSTEM

Open CodeFinder2 opened this issue 2 years ago • 1 comments

Hi,

due to the use of directory_options, this requires at least Boost 1.72, not 1.54 as stated in the README.

 1.72.0
 New: Added directory_options enum, which reflects the same named enum from C++20. The enum is supported in directory_iterator and recursive_directory_iterator to customize iteration behavior. In particular, the iterators now support skipping directories that can't be opened due to insufficient permissions. The symlink_option enum is now deprecated and should be replaced with directory_options.

See also https://www.boost.org/doc/libs/1_72_0/libs/filesystem/doc/release_history.html

May I create a PR to add compatibility for older Boost versions?

There are also issues when using USE_BOOST_FILESYSTEM=ON on Ubuntu 18.04 so that I would address them in the PR as well.

  • include/inotify-cpp/FileSystemAdapter.h:35:36: error: invalid return type ‘boost::none_t’ of constexpr function ‘constexpr boost::none_t inotifypp::nullopt()’ inline constexpr boost::none_t nullopt() { return boost::none; };
  • src/Inotify.cpp:108:27: error: ‘fs::directory_options’ has not been declared path, fs::directory_options::follow_directory_symlink, ec);
  • include/inotify-cpp/FileSystemAdapter.h:5:10: fatal error: filesystem: No such file or directory #include <filesystem> (when included, e.g., from main(), library integrated via CPM). This is because the in main.cpp, the definition is not available because it is not forwarded (added) in CMake to the inotify-cpp target. Alternatively, creating a configure file would work as well (making the definitions available to includes as well).

CodeFinder2 avatar Jul 04 '22 14:07 CodeFinder2

Changes in the following files/lines would be necessary:

  • include/inotify-cpp/FileSystemAdapter.h:{5,39}
  • src/Inotify.cpp:108

CodeFinder2 avatar Jul 04 '22 14:07 CodeFinder2