]> git.ipfire.org Git - thirdparty/ccache.git/commitdiff
fix: Hash variables that affect Clang version on macOS
authorJoel Rosdahl <joel@rosdahl.net>
Thu, 3 Nov 2022 19:45:21 +0000 (20:45 +0100)
committerJoel Rosdahl <joel@rosdahl.net>
Thu, 3 Nov 2022 21:10:43 +0000 (22:10 +0100)
Fixes #1205.

src/ccache.cpp

index 392818ff31a53699709355ca37eb515ce9d90ab9..9bc5c5f2bb103c558d22e9c81a110c22790a22ae 100644 (file)
@@ -1376,11 +1376,17 @@ hash_common_info(const Context& ctx,
 
   // Hash variables that may affect the compilation.
   const char* always_hash_env_vars[] = {
-    // From <https://gcc.gnu.org/onlinedocs/gcc/Environment-Variables.html>:
+    // From <https://gcc.gnu.org/onlinedocs/gcc/Environment-Variables.html>
+    // (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);