From 5582907a4a6ff20618be868f19917c49621bdb91 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..1b63798 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 /usr/local/include/fuse/fuse.h AND EXISTS /usr/local/lib/libfuse.dylib) + 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 /usr/local/include/osxfuse/fuse/fuse.h AND EXISTS /usr/local/lib/libosxfuse.dylib) + 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)