From 4907e33f37720998b154d422f611ff5a1cb10493 Mon Sep 17 00:00:00 2001 From: George Tokmaji Date: Fri, 29 Nov 2024 00:04:56 +0100 Subject: [PATCH] macOS: Link libc++ statically so that installing LLVM via brew isn't required to run the executables --- autobuild/clang16_mac.cmake | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/autobuild/clang16_mac.cmake b/autobuild/clang16_mac.cmake index 2e206d50a..d7fda59f3 100644 --- a/autobuild/clang16_mac.cmake +++ b/autobuild/clang16_mac.cmake @@ -2,9 +2,9 @@ cmake_minimum_required(VERSION 3.20) set(CMAKE_C_COMPILER "/usr/local/opt/llvm/bin/clang") set(CMAKE_CXX_COMPILER "/usr/local/opt/llvm/bin/clang++") -set(CMAKE_C_FLAGS_INIT "-stdlib=libc++ -fexperimental-library -Wno-parentheses") -set(CMAKE_CXX_FLAGS_INIT "${CMAKE_C_FLAGS_INIT}") -set(CMAKE_OBJCXX_FLAGS_INIT "${CMAKE_CXX_FLAGS_INIT}") +set(CMAKE_C_FLAGS_INIT "-fexperimental-library -Wno-parentheses") +set(CMAKE_CXX_FLAGS_INIT "-nostdlib++ ${CMAKE_C_FLAGS_INIT}") +set(CMAKE_OBJCXX_FLAGS_INIT "-nostdlib++ ${CMAKE_CXX_FLAGS_INIT}") -set(CMAKE_EXE_LINKER_FLAGS_INIT "-L/usr/local/opt/llvm/lib/c++") -set(CMAKE_SHARED_LINKER_FLAGS_INIT "-L/usr/local/opt/llvm/lib/c++") +set(CMAKE_EXE_LINKER_FLAGS_INIT "/usr/local/opt/llvm/lib/c++/libc++.a /usr/local/opt/llvm/lib/c++/libc++abi.a /usr/local/opt/llvm/lib/c++/libc++experimental.a") +set(CMAKE_SHARED_LINKER_FLAGS_INIT "/usr/local/opt/llvm/lib/c++/libc++.a /usr/local/opt/llvm/lib/c++/libc++abi.a /usr/local/opt/llvm/lib/c++/libc++experimental.a")