1
0
mirror of synced 2025-01-29 19:17:28 +01:00

build: Only fix libarchive include dirs when necessary

This commit is contained in:
WerWolv 2023-12-24 14:30:10 +01:00
parent 24f8ce9d7f
commit 7eb92c68de

View File

@ -3,22 +3,19 @@ cmake_minimum_required(VERSION 3.16)
include(ImHexPlugin)
# Homebrew only ships a libarchive keg, include directories have to be set manually
if (APPLE)
find_package(Brew QUIET)
if (Brew_FOUND)
execute_process(
COMMAND (${BREW_EXECUTABLE} --prefix libarchive) || exit 0
OUTPUT_VARIABLE LIBARCHIVE_PREFIX
OUTPUT_STRIP_TRAILING_WHITESPACE
COMMAND_ERROR_IS_FATAL ANY
)
find_package(LibArchive REQUIRED)
if (APPLE AND LibArchive_INCLUDE_DIR STREQUAL "")
execute_process(
COMMAND (${BREW_EXECUTABLE} --prefix libarchive) || exit 0
OUTPUT_VARIABLE LIBARCHIVE_PREFIX
OUTPUT_STRIP_TRAILING_WHITESPACE
COMMAND_ERROR_IS_FATAL ANY
)
if (NOT LIBARCHIVE_PREFIX STREQUAL "")
set(LibArchive_INCLUDE_DIR "${LIBARCHIVE_PREFIX}/include")
endif()
if (NOT LIBARCHIVE_PREFIX STREQUAL "")
set(LibArchive_INCLUDE_DIR "${LIBARCHIVE_PREFIX}/include")
endif()
endif()
find_package(LibArchive REQUIRED)
add_imhex_plugin(
NAME