From f3af3d1c14afe6c4cb0f1957a82de837d1ff588e Mon Sep 17 00:00:00 2001 From: Joe Drago Date: Sun, 1 Nov 2020 18:16:27 -0800 Subject: [PATCH] Fix clang build on macOS --- CMakeLists.txt | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/CMakeLists.txt b/CMakeLists.txt index 97e373f..603ed29 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -85,6 +85,12 @@ if(CMAKE_CXX_COMPILER_ID MATCHES "Clang") -Wno-switch-enum -Wno-undef ) + # The detection of cross compilation by -Wpoison-system-directories has false positives on macOS because + # --sysroot is implicitly added. Turn the warning off. + check_c_compiler_flag(-Wpoison-system-directories HAVE_POISON_SYSTEM_DIRECTORIES_WARNING) + if(HAVE_POISON_SYSTEM_DIRECTORIES_WARNING) + add_definitions(-Wno-poison-system-directories) + endif() elseif(CMAKE_CXX_COMPILER_ID MATCHES "GNU") add_definitions(-std=c99) # Enforce C99 for gcc MESSAGE(STATUS "Enabling warnings (for colorist lib/bin) for GCC")