From ddb07e896a2a8af79512543b1c7eb9797f8898a5 Mon Sep 17 00:00:00 2001 From: Cory Benfield Date: Fri, 25 Feb 2022 17:51:00 +0000 Subject: [PATCH] build: attempt to workaround linker issues on Darwin (#105) (#106) The use of a non-cctools librarian causes ld64 some heartburn. Explicitly opt into using the cctools librarian. rdar://87850031 (cherry picked from commit facc82fbb465e8e308ceeeeb2bdd2830ae8023b3) Co-authored-by: Saleem Abdulrasool --- CMakeLists.txt | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/CMakeLists.txt b/CMakeLists.txt index 881a872c..f0da9625 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -37,6 +37,11 @@ if(BUILD_SHARED_LIBS) set(CMAKE_POSITION_INDEPENDENT_CODE YES) endif() +if(CMAKE_SYSTEM_NAME STREQUAL Darwin AND NOT CMAKE_CROSSCOMPILING) + set(CMAKE_AR "/usr/bin/ar") + set(CMAKE_C_ARCHIVE_CREATE " crs ") +endif() + if(NOT CMAKE_SYSTEM_NAME STREQUAL Darwin) find_package(dispatch CONFIG) find_package(Foundation CONFIG)