From c20a4e8b5ecf04df1d6a361f95873997e5b36736 Mon Sep 17 00:00:00 2001 From: Charles Giessen Date: Thu, 6 Aug 2026 10:55:18 -0500 Subject: [PATCH] build: Avoid AppleClang using the wrong headers Because of AppleClang always adding /usr/local/include and CMake using -isystem by default in 3.25+, builds on MacOS could use system installed headers by mistake. Because this repo has code generated against a specific version of the Vulkan Headers, if the system installed headers are older (which is usually the case for developers of this repo) then the build fails. --- CMakeLists.txt | 10 +++++++++- 1 file changed, 9 insertions(+), 1 deletion(-) diff --git a/CMakeLists.txt b/CMakeLists.txt index f0bea577..ec6037de 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -13,8 +13,9 @@ # See the License for the specific language governing permissions and # limitations under the License. # -# Authors: +# Authors: # - Christophe Riccio +# - Charles Giessen # ~~~ cmake_minimum_required(VERSION 3.22.1) @@ -80,6 +81,13 @@ find_package(VulkanUtilityLibraries REQUIRED CONFIG QUIET) find_package(valijson REQUIRED CONFIG) find_package(jsoncpp REQUIRED CONFIG) +# Workaround AppleClang using the wrong headers when there are headers in /usr/local/include +if (CMAKE_CXX_COMPILER_ID STREQUAL AppleClang AND TARGET Vulkan::Headers AND TARGET Vulkan::LayerSettings AND CMAKE_VERSION VERSION_GREATER_EQUAL 3.25) + set_target_properties(Vulkan::Headers PROPERTIES SYSTEM OFF) + set_target_properties(Vulkan::LayerSettings PROPERTIES SYSTEM OFF) + set_target_properties(Vulkan::UtilityHeaders PROPERTIES SYSTEM OFF) +endif() + option(BUILD_TESTS "Build the tests") if (BUILD_TESTS) enable_testing()