From a862e32a61e7f3f9d7ad946cf050f6a06b75a4a1 Mon Sep 17 00:00:00 2001 From: Joel Rosdahl Date: Thu, 3 Nov 2022 20:45:21 +0100 Subject: [PATCH] fix: Hash variables that affect Clang version on macOS Fixes #1205. --- src/ccache.cpp | 10 ++++++++-- 1 file changed, 8 insertions(+), 2 deletions(-) diff --git a/src/ccache.cpp b/src/ccache.cpp index 392818ff3..9bc5c5f2b 100644 --- a/src/ccache.cpp +++ b/src/ccache.cpp @@ -1376,11 +1376,17 @@ hash_common_info(const Context& ctx, // Hash variables that may affect the compilation. const char* always_hash_env_vars[] = { - // From : + // From + // (note: SOURCE_DATE_EPOCH is handled in hash_source_code_string()): "COMPILER_PATH", "GCC_COMPARE_DEBUG", "GCC_EXEC_PREFIX", - // Note: SOURCE_DATE_EPOCH is handled in hash_source_code_string(). +#ifdef __APPLE__ + // On macOS, /usr/bin/clang is a compiler wrapper that switches compiler + // based on at least these variables: + "DEVELOPER_DIR", + "MACOSX_DEPLOYMENT_TARGET", +#endif }; for (const char* name : always_hash_env_vars) { const char* value = getenv(name); -- 2.47.2