1
0
mirror of synced 2024-11-24 15:50:16 +01:00

build: Try detecting macOS better when updating libarchive include path

This commit is contained in:
WerWolv 2023-12-27 00:38:32 +01:00
parent 40e66313a9
commit a0fddd2953

View File

@ -3,21 +3,16 @@ cmake_minimum_required(VERSION 3.16)
include(ImHexPlugin) include(ImHexPlugin)
# Homebrew only ships a libarchive keg, include directories have to be set manually # Homebrew only ships a libarchive keg, include directories have to be set manually
find_package(LibArchive) if(${CMAKE_HOST_SYSTEM_NAME} MATCHES "Darwin")
if (NOT DEFINED LibArchive_INCLUDE_DIR OR LibArchive_INCLUDE_DIR STREQUAL "") execute_process(
if (${CMAKE_SYSTEM_NAME} STREQUAL "Darwin") COMMAND brew --prefix libarchive
execute_process( OUTPUT_VARIABLE LIBARCHIVE_PREFIX
COMMAND (${BREW_EXECUTABLE} --prefix libarchive) || exit 0 OUTPUT_STRIP_TRAILING_WHITESPACE
OUTPUT_VARIABLE LIBARCHIVE_PREFIX COMMAND_ERROR_IS_FATAL ANY
OUTPUT_STRIP_TRAILING_WHITESPACE )
COMMAND_ERROR_IS_FATAL ANY set(LibArchive_INCLUDE_DIR "${LIBARCHIVE_PREFIX}/include")
)
if (NOT LIBARCHIVE_PREFIX STREQUAL "")
set(LibArchive_INCLUDE_DIR "${LIBARCHIVE_PREFIX}/include")
endif()
endif()
endif() endif()
find_package(LibArchive REQUIRED)
add_imhex_plugin( add_imhex_plugin(
NAME NAME