aboutsummaryrefslogtreecommitdiff
path: root/cmake
diff options
context:
space:
mode:
authorNadia Holmquist Pedersen <nadia@nhp.sh>2021-07-23 06:31:20 +0200
committerNadia Holmquist Pedersen <nadia@nhp.sh>2021-09-15 22:13:04 +0200
commitf21ae77a0174c9ced5e61dc2b1df6499e71fe930 (patch)
tree172d9a38b86283e6a4d1915489880c7614bbdb2a /cmake
parent66a58f74784037c3736f1fc0945e608248842d22 (diff)
Allow for using LLVM from Homebrew and include its libc++
Diffstat (limited to 'cmake')
-rw-r--r--cmake/Toolchain-Homebrew-LLVM.cmake12
1 files changed, 12 insertions, 0 deletions
diff --git a/cmake/Toolchain-Homebrew-LLVM.cmake b/cmake/Toolchain-Homebrew-LLVM.cmake
new file mode 100644
index 0000000..15b6d24
--- /dev/null
+++ b/cmake/Toolchain-Homebrew-LLVM.cmake
@@ -0,0 +1,12 @@
+# Toolchain file for building with Homebrew's LLVM on macOS
+# This is useful on 10.14 where std::filesystem is not supported.
+
+set(CMAKE_C_COMPILER /usr/local/opt/llvm/bin/clang)
+set(CMAKE_CXX_COMPILER /usr/local/opt/llvm/bin/clang++)
+
+add_link_options(-L/usr/local/opt/llvm/lib)
+
+# LLVM in Homebrew is built with latest Xcode which has a newer linker than
+# what is bundled in the default install of Xcode Command Line Tools, so we
+# override it to prevent it passing flags not supported by the system's ld.
+add_link_options(-mlinker-version=450)