From b87dadf4a771e8ab01cb180a42bd39d01608689c Mon Sep 17 00:00:00 2001 From: Carlo Cabrera <30379873+carlocab@users.noreply.github.com> Date: Sat, 1 Jun 2024 02:35:16 +0800 Subject: [PATCH] build: Fix detection and usage of system blake3 (#1464) --- cmake/FindBlake3.cmake | 2 +- src/ccache/Hash.hpp | 3 ++- src/third_party/blake3/CMakeLists.txt | 2 +- 3 files changed, 4 insertions(+), 3 deletions(-) diff --git a/cmake/FindBlake3.cmake b/cmake/FindBlake3.cmake index 501353c9..f7d2a81a 100644 --- a/cmake/FindBlake3.cmake +++ b/cmake/FindBlake3.cmake @@ -8,7 +8,7 @@ else() find_library(BLAKE3_LIBRARY blake3) if(BLAKE3_INCLUDE_DIR) file(READ "${BLAKE3_INCLUDE_DIR}/blake3.h" _blake3_h) - string(REGEX MATCH "#define _blake3_version_string \"([0-9]+).([0-9]+).*([0-9]+)\"" _ "${_blake3_h}") + string(REGEX MATCH "#define BLAKE3_VERSION_STRING \"([0-9]+).([0-9]+).*([0-9]+)\"" _ "${_blake3_h}") set(_blake3_version_string "${CMAKE_MATCH_1}.${CMAKE_MATCH_2}.${CMAKE_MATCH_3}") if(NOT "${CMAKE_MATCH_0}" STREQUAL "" AND "${_blake3_version_string}" VERSION_GREATER_EQUAL "${Blake3_FIND_VERSION}") if(BLAKE3_LIBRARY) diff --git a/src/ccache/Hash.hpp b/src/ccache/Hash.hpp index 4ac7503f..87be969c 100644 --- a/src/ccache/Hash.hpp +++ b/src/ccache/Hash.hpp @@ -21,10 +21,11 @@ #include #include -#include #include #include +#include + #include #include #include diff --git a/src/third_party/blake3/CMakeLists.txt b/src/third_party/blake3/CMakeLists.txt index 8d0e9620..0f69337d 100644 --- a/src/third_party/blake3/CMakeLists.txt +++ b/src/third_party/blake3/CMakeLists.txt @@ -7,7 +7,7 @@ add_library( "${CMAKE_CURRENT_SOURCE_DIR}/blake3/blake3_portable.c" ) -target_include_directories(dep_blake3 INTERFACE "${CMAKE_CURRENT_SOURCE_DIR}") +target_include_directories(dep_blake3 INTERFACE "${CMAKE_CURRENT_SOURCE_DIR}/blake3") target_link_libraries(dep_blake3 PRIVATE standard_settings) if(MSVC) -- 2.47.2