From 2f95fc3b3c85a078c04fd65c2d16c96310f45daf Mon Sep 17 00:00:00 2001
Message-ID: <2f95fc3b3c85a078c04fd65c2d16c96310f45daf.1709318446.git.github@sicherha.de>
From: Christoph Erhardt <github@sicherha.de>
Date: Sat, 6 Aug 2022 09:18:54 +0200
Subject: [PATCH 1/2] Use system-compatible include path for `xxhash.h`

Distributors that build mold against the system-provided xxHash package
expect its header file `xxhash.h` in the top-level include directory,
not in an `xxhash` subdirectory. Adjust the include path and the
`#include` directive accordingly.
---
 CMakeLists.txt  | 2 ++
 common/common.h | 2 +-
 2 files changed, 3 insertions(+), 1 deletion(-)

diff --git a/CMakeLists.txt b/CMakeLists.txt
index c6d00990..82f338f9 100644
--- a/CMakeLists.txt
+++ b/CMakeLists.txt
@@ -212,6 +212,8 @@ else()
   mold_add_tbb()
 endif()
 
+target_include_directories(mold PRIVATE third-party/xxhash)
+
 # We always use Clang to build mold on Windows. MSVC can't compile mold.
 if(WIN32)
   if(MSVC AND NOT CMAKE_CXX_COMPILER_ID STREQUAL "Clang")
diff --git a/common/common.h b/common/common.h
index b7e002a6..5ddc9213 100644
--- a/common/common.h
+++ b/common/common.h
@@ -34,7 +34,7 @@
 #endif
 
 #define XXH_INLINE_ALL 1
-#include "../third-party/xxhash/xxhash.h"
+#include <xxhash.h>
 
 #ifdef NDEBUG
 # define unreachable() __builtin_unreachable()
-- 
2.44.0

