mold/0001-Use-system-compatible-...

45 lines
1.3 KiB
Diff

From 73862d08e89da6b2c72eabbf3f61d612974e2ee0 Mon Sep 17 00:00:00 2001
Message-Id: <73862d08e89da6b2c72eabbf3f61d612974e2ee0.1668329176.git.github@sicherha.de>
From: Christoph Erhardt <github@sicherha.de>
Date: Sat, 6 Aug 2022 09:18:54 +0200
Subject: [PATCH] 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 ++
mold.h | 2 +-
2 files changed, 3 insertions(+), 1 deletion(-)
diff --git a/CMakeLists.txt b/CMakeLists.txt
index 3c14940c..23e1d712 100644
--- a/CMakeLists.txt
+++ b/CMakeLists.txt
@@ -191,6 +191,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(NOT CMAKE_CXX_COMPILER_ID STREQUAL "Clang")
diff --git a/mold.h b/mold.h
index 6f9fe2e8..5ebad268 100644
--- a/mold.h
+++ b/mold.h
@@ -32,7 +32,7 @@
#endif
#define XXH_INLINE_ALL 1
-#include "third-party/xxhash/xxhash.h"
+#include <xxhash.h>
#ifdef NDEBUG
# define unreachable() __builtin_unreachable()
--
2.38.1