Skip to content

Commit 62c47fe

Browse files
committed
build: Avoid AppleClang using the wrong headers for ProfilesLayer
see related PR #928 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.
1 parent 2748a89 commit 62c47fe

1 file changed

Lines changed: 6 additions & 0 deletions

File tree

layer/CMakeLists.txt

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -101,6 +101,12 @@ endif()
101101
set_target_properties(ProfilesLayer PROPERTIES FOLDER "Profiles layer")
102102
set_target_properties(ProfilesLayer PROPERTIES OUTPUT_NAME ${LAYER_NAME})
103103

104+
# Workaround AppleClang searching /usr/local/include ahead of -isystem paths, which can
105+
# pick up a stale, globally-installed Vulkan SDK header instead of this project's own.
106+
if (CMAKE_CXX_COMPILER_ID STREQUAL AppleClang AND CMAKE_VERSION VERSION_GREATER_EQUAL 3.25)
107+
set_target_properties(ProfilesLayer PROPERTIES NO_SYSTEM_FROM_IMPORTED ON)
108+
endif()
109+
104110
if (MSVC)
105111
target_compile_options(ProfilesLayer PRIVATE "$<$<CONFIG:Release>:/Zi>")
106112
target_link_options(ProfilesLayer PRIVATE /DEF:${CMAKE_CURRENT_SOURCE_DIR}/${LAYER_NAME}.def)

0 commit comments

Comments
 (0)