From c2effbfd4a072ea6c9cd013b4e6a2f17434be32e Mon Sep 17 00:00:00 2001 From: "Mark R. Tuttle" Date: Wed, 15 Sep 2021 18:26:46 -0400 Subject: [PATCH] Build with /usr/bin/clang on MacOS --- CMakeLists.txt | 10 ++++++++++ 1 file changed, 10 insertions(+) diff --git a/CMakeLists.txt b/CMakeLists.txt index 1cb6c78ec73..552454045af 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -1,5 +1,15 @@ cmake_minimum_required(VERSION 3.2) +# Compile with /usr/bin/clang on MacOS +# See https://github.com/diffblue/cbmc/issues/4956 +# +if (CMAKE_HOST_SYSTEM_NAME STREQUAL Darwin) + if(NOT DEFINED CMAKE_C_COMPILER) + message(STATUS "Setting CMAKE_C_COMPILER to /usr/bin/clang for MacOS") + set(CMAKE_C_COMPILER "/usr/bin/clang") + endif() +endif() + # If cmake generates files inside of the cbmc source directory this can lead to important files being overwritten, so we prevent that here if("${CMAKE_BINARY_DIR}" STREQUAL "${CMAKE_SOURCE_DIR}") message(FATAL_ERROR