-
Notifications
You must be signed in to change notification settings - Fork 15
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Refactor the setup of std::filesystem to avoid code duplication
- Loading branch information
Showing
1 changed file
with
22 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,22 @@ | ||
|
||
# h5pp requires the filesystem header (and possibly stdc++fs library) | ||
find_package(Filesystem COMPONENTS Final Experimental) | ||
if (TARGET std::filesystem) | ||
target_link_libraries(deps INTERFACE std::filesystem) | ||
list(APPEND H5PP_TARGETS std::filesystem) | ||
elseif(H5PP_PACKAGE_MANAGER MATCHES "cmake|fetch|conan") | ||
message(STATUS "Your compiler lacks std::filesystem. A drop-in replacement 'ghc::filesystem' will be downloaded") | ||
message(STATUS "Read more about ghc::filesystem here: /~https://github.com/gulrak/filesystem") | ||
include(cmake/Get_ghcFilesystem.cmake) | ||
if(TARGET ghcFilesystem::ghc_filesystem) | ||
target_link_libraries(deps INTERFACE ghcFilesystem::ghc_filesystem) | ||
list(APPEND H5PP_TARGETS ghcFilesystem::ghc_filesystem) | ||
else() | ||
message(WARNING "Your compiler lacks std::filesystem and installing the drop-in replacement 'ghc::filesystem' failed.") | ||
message(FATAL_ERROR "<filesystem> header and/or library not found") | ||
endif() | ||
else() | ||
message(STATUS "Your compiler lacks std::filesystem. Set H5PP_PACKAGE_MANAGER to 'cmake', 'fetch' or 'conan' to get the ghc::filesystem replacement") | ||
message(STATUS "Read more about ghc::filesystem here: /~https://github.com/gulrak/filesystem") | ||
message(FATAL_ERROR "<filesystem> header and/or library not found") | ||
endif() |