diff --git a/src/CMakeLists.txt b/src/CMakeLists.txt index 55cfaa4..47d849f 100644 --- a/src/CMakeLists.txt +++ b/src/CMakeLists.txt @@ -1,3 +1,6 @@ +find_package(PkgConfig REQUIRED) +pkg_check_modules(xxhash REQUIRED libxxhash) + set( source_files Args.cpp @@ -57,10 +60,10 @@ set(THREADS_PREFER_PTHREAD_FLAG ON) find_package(Threads REQUIRED) target_link_libraries( ccache_framework - PRIVATE standard_settings standard_warnings ZSTD::ZSTD Threads::Threads third_party + PRIVATE standard_settings standard_warnings ZSTD::ZSTD Threads::Threads third_party ${xxhash_LIBRARIES} ) -target_include_directories(ccache_framework PUBLIC ${CMAKE_BINARY_DIR} ${CMAKE_CURRENT_SOURCE_DIR}) +target_include_directories(ccache_framework PUBLIC ${CMAKE_BINARY_DIR} ${CMAKE_CURRENT_SOURCE_DIR} ${xxhash_INCLUDE_DIRS}) if(REDIS_STORAGE_BACKEND) target_compile_definitions(ccache_framework PUBLIC -DHAVE_REDIS_STORAGE_BACKEND) diff --git a/src/third_party/CMakeLists.txt b/src/third_party/CMakeLists.txt index 0d6ffb3..f05a102 100644 --- a/src/third_party/CMakeLists.txt +++ b/src/third_party/CMakeLists.txt @@ -1,4 +1,4 @@ -add_library(third_party STATIC base32hex.c format.cpp httplib.cpp url.cpp xxhash.c) +add_library(third_party STATIC base32hex.c format.cpp httplib.cpp url.cpp) if(NOT MSVC) target_sources(third_party PRIVATE getopt_long.c) else() @@ -29,16 +29,6 @@ int main() file(WRITE "${CMAKE_CURRENT_BINARY_DIR}/xxhdispatchtest.c" "${xxhdispatchtest}") -try_compile(USE_XXH_DISPATCH ${CMAKE_CURRENT_BINARY_DIR} - "${CMAKE_CURRENT_BINARY_DIR}/xxhdispatchtest.c" - CMAKE_FLAGS "-DINCLUDE_DIRECTORIES=${CMAKE_CURRENT_SOURCE_DIR}" - COMPILE_DEFINITIONS "-DXXH_STATIC_LINKING_ONLY") - -target_compile_definitions(third_party INTERFACE "-DXXH_STATIC_LINKING_ONLY") -if(USE_XXH_DISPATCH) - target_sources(third_party PRIVATE xxh_x86dispatch.c) - target_compile_definitions(third_party INTERFACE "-DUSE_XXH_DISPATCH") -endif() # Treat third party headers as system files (no warning for those headers). target_include_directories( diff --git a/src/util/XXH3_128.hpp b/src/util/XXH3_128.hpp index 309ac7c..f9865a6 100644 --- a/src/util/XXH3_128.hpp +++ b/src/util/XXH3_128.hpp @@ -25,7 +25,7 @@ #ifdef USE_XXH_DISPATCH # include #else -# include +# include #endif #include diff --git a/src/util/XXH3_64.hpp b/src/util/XXH3_64.hpp index 61f0fab..11b416b 100644 --- a/src/util/XXH3_64.hpp +++ b/src/util/XXH3_64.hpp @@ -21,7 +21,7 @@ #ifdef USE_XXH_DISPATCH # include "third_party/xxh_x86dispatch.h" #else -# include "third_party/xxhash.h" +# include #endif #include