pw_toolchain: Use CIPD libc++ for mac+CMake

Updates the CMake clang host toolchain to use the CIPD provided libc++
to mirror the GN build.

Change-Id: I53cc2b773f922d2ee40f643a3010bc269fc15315
Reviewed-on: https://pigweed-review.googlesource.com/c/pigweed/pigweed/+/80228
Reviewed-by: Wyatt Hepler <hepler@google.com>
Commit-Queue: Armando Montanez <amontanez@google.com>
Pigweed-Auto-Submit: Armando Montanez <amontanez@google.com>
diff --git a/pw_toolchain/host_clang/BUILD.gn b/pw_toolchain/host_clang/BUILD.gn
index 5514d23..61d00aa 100644
--- a/pw_toolchain/host_clang/BUILD.gn
+++ b/pw_toolchain/host_clang/BUILD.gn
@@ -110,7 +110,7 @@
 # not on Linux) will fall back to the system libc++, which is
 # incompatible due to an ABI change.
 #
-# Pull the appropriate pathd from our Pigweed env setup.
+# Pull the appropriate paths from our Pigweed env setup.
 config("no_system_libcpp") {
   if (current_os == "mac") {
     install_dir = getenv("PW_PIGWEED_CIPD_INSTALL_DIR")
diff --git a/pw_toolchain/host_clang/toolchain.cmake b/pw_toolchain/host_clang/toolchain.cmake
index 803287e..ae34701 100644
--- a/pw_toolchain/host_clang/toolchain.cmake
+++ b/pw_toolchain/host_clang/toolchain.cmake
@@ -61,5 +61,15 @@
 # TODO: Migrate this to match GN's tokenized trace setup.
 pw_set_backend(pw_trace pw_trace.null)
 
+# The CIPD provided Clang/LLVM toolchain must link against the matched
+# libc++ which is also from CIPD. However, by default, Clang on Mac (but
+# not on Linux) will fall back to the system libc++, which is
+# incompatible due to an ABI change.
+#
+# Pull the appropriate paths from our Pigweed env setup.
+if(CMAKE_SYSTEM_NAME STREQUAL "Darwin")
+    set(CMAKE_EXE_LINKER_FLAGS "${CMAKE_EXE_LINKER_FLAGS} -nostdlib++ $ENV{PW_PIGWEED_CIPD_INSTALL_DIR}/lib/libc++.a")
+endif()
+
 set(pw_build_WARNINGS pw_build.strict_warnings pw_build.extra_strict_warnings
     CACHE STRING "" FORCE)