Do not include MacOSX path if we are not in OSX

Copybara Import from https://github.com/bazelbuild/rules_cc/pull/597

BEGIN_PUBLIC
Do not include MacOSX path if we are not in OSX (#597)

This keeps the generated file on Linux free from unnecessary paths

Closes #597
END_PUBLIC

COPYBARA_INTEGRATE_REVIEW=https://github.com/bazelbuild/rules_cc/pull/597 from limdor:invalid_path 0d35f1525c878ef43d2a4921bbe866fe4289a946
PiperOrigin-RevId: 875320702
Change-Id: I2a742fe80a38dc8936c79fe51b511fe03f0990c4
diff --git a/cc/private/toolchain/unix_cc_configure.bzl b/cc/private/toolchain/unix_cc_configure.bzl
index 5aed026..f9ea53d 100644
--- a/cc/private/toolchain/unix_cc_configure.bzl
+++ b/cc/private/toolchain/unix_cc_configure.bzl
@@ -597,7 +597,7 @@
         ) +
         # Always included in case the user has Xcode + the CLT installed, both
         # paths can be used interchangeably
-        ["/Library/Developer/CommandLineTools/SDKs/MacOSX.sdk"],
+        (["/Library/Developer/CommandLineTools/SDKs/MacOSX.sdk"] if darwin else []),
     )
 
     generate_modulemap = is_clang