Skip to content

Commit

Permalink
Fix the way to find libarchive on macOS (#730)
Browse files Browse the repository at this point in the history
  • Loading branch information
ken-matsui authored Dec 19, 2022
1 parent 4c1ca89 commit 3b22d3c
Showing 1 changed file with 12 additions and 3 deletions.
15 changes: 12 additions & 3 deletions cmake/AddLibArchive.cmake
Original file line number Diff line number Diff line change
Expand Up @@ -5,9 +5,18 @@ list(APPEND CMAKE_MESSAGE_INDENT " ")

include(cmake/CPM.cmake)

if (APPLE)
# To support finding LibArchive on macOS
set(LibArchive_INCLUDE_DIR "${POAC_HOMEBREW_ROOT_PATH}/libarchive/include")
if (DEFINED LibArchive_INCLUDE_DIR)
message(STATUS "LibArchive_INCLUDE_DIR has been set manually: ${LibArchive_INCLUDE_DIR}")
else ()
set(LIBARCHIVE_INCLUDE_DIR_TMP "${POAC_HOMEBREW_ROOT_PATH}/libarchive/include")
if (APPLE AND EXISTS "${LIBARCHIVE_INCLUDE_DIR_TMP}/archive.h")
# To support finding LibArchive on macOS
set(LibArchive_INCLUDE_DIR ${LIBARCHIVE_INCLUDE_DIR_TMP})
message(STATUS "LibArchive_INCLUDE_DIR has been set automatically: ${LibArchive_INCLUDE_DIR}")
else ()
message(STATUS "LibArchive_INCLUDE_DIR could not be set automatically")
endif ()
unset(LIBARCHIVE_INCLUDE_DIR_TMP)
endif ()

set(CMAKE_PROJECT_libarchive_INCLUDE_BEFORE "${CMAKE_SOURCE_DIR}/cmake/LibArchivePoliciesFix.cmake")
Expand Down

0 comments on commit 3b22d3c

Please sign in to comment.