From d578ca985760cecbd5287c4f0c95b18511ca7bfb Mon Sep 17 00:00:00 2001 From: Tom Sullivan Date: Mon, 5 Jul 2021 16:58:22 +1000 Subject: [PATCH] Handle macFUSE and OSXFUSE With the change of project from OSXFUSE to macFUSE, the header and library paths have changed, so update the CMake configuration to handle both, and to properly error out if neither are found under macOS --- CMakeLists.txt | 30 ++++++++++++++++++++---------- 1 file changed, 20 insertions(+), 10 deletions(-) diff --git a/CMakeLists.txt b/CMakeLists.txt index 83d31bc..223f368 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -117,17 +117,27 @@ add_executable(apfs-fuse apfsfuse/ApfsFuse.cpp) target_compile_definitions(apfs-fuse PRIVATE _FILE_OFFSET_BITS=64 _DARWIN_USE_64_BIT_INODE) if (APPLE) -target_include_directories(apfs-fuse PRIVATE /usr/local/include/osxfuse/) -# link_directories(/usr/local/lib/) -target_link_libraries(apfs-fuse apfs /usr/local/lib/libosxfuse.dylib) -target_compile_definitions(apfs-fuse PRIVATE USE_FUSE2) + if(EXISTS /Library/Frameworks/macFUSE.framework/macFUSE) + message(STATUS "Using macFUSE package") + target_compile_definitions(apfs-fuse PRIVATE USE_FUSE2) + target_include_directories(apfs-fuse PRIVATE /usr/local/include/) + target_link_libraries(apfs-fuse apfs /usr/local/lib/libfuse.dylib) + elseif(EXISTS /Library/Frameworks/OSXFUSE.framework/OSXFUSE) + message(STATUS "Using OSXFUSE package") + target_compile_definitions(apfs-fuse PRIVATE USE_FUSE2) + target_include_directories(apfs-fuse PRIVATE /usr/local/include/osxfuse/) + target_link_libraries(apfs-fuse apfs /usr/local/lib/libosxfuse.dylib) + else() + message(FATAL_ERROR "Unable to find FUSE package") + endif() else() -if (USE_FUSE3) -target_link_libraries(apfs-fuse apfs fuse3) -else() -target_link_libraries(apfs-fuse apfs fuse) -target_compile_definitions(apfs-fuse PRIVATE USE_FUSE2) -endif() + if (USE_FUSE3) + target_link_libraries(apfs-fuse apfs fuse3) + else() + message(BAR) + target_link_libraries(apfs-fuse apfs fuse) + target_compile_definitions(apfs-fuse PRIVATE USE_FUSE2) + endif() endif() add_executable(apfsutil ApfsUtil/ApfsUtil.cpp)