Skip to content

Fix build when SDK is installed globally - #1999

Merged
charles-lunarg merged 1 commit into
KhronosGroup:mainfrom
charles-lunarg:fix_clang_using_usr_local_include
Aug 5, 2026
Merged

Fix build when SDK is installed globally#1999
charles-lunarg merged 1 commit into
KhronosGroup:mainfrom
charles-lunarg:fix_clang_using_usr_local_include

Conversation

@charles-lunarg

Copy link
Copy Markdown
Collaborator

Because of clang 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.

Fix it by marking the Vulkan::Headers target as not a system target.

Because of clang 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.

Fix it by marking the Vulkan::Headers target as not a system target.
@ci-tester-lunarg

Copy link
Copy Markdown

CI Vulkan-Loader build queued with queue ID 65375.

@charles-lunarg charles-lunarg linked an issue Aug 4, 2026 that may be closed by this pull request
@ci-tester-lunarg

Copy link
Copy Markdown

CI Vulkan-Loader build queued with queue ID 65392.

@ci-tester-lunarg

Copy link
Copy Markdown

CI Vulkan-Loader build # 3679 running.

@ci-tester-lunarg

Copy link
Copy Markdown

CI Vulkan-Loader build # 3679 passed.

@charles-lunarg
charles-lunarg merged commit 160db0e into KhronosGroup:main Aug 5, 2026
51 checks passed
@charles-lunarg
charles-lunarg deleted the fix_clang_using_usr_local_include branch August 5, 2026 16:23
Comment thread CMakeLists.txt
endif()

if (CMAKE_C_COMPILER_ID STREQUAL AppleClang AND TARGET Vulkan::Headers AND CMAKE_VERSION VERSION_GREATER_EQUAL 3.25)
set_target_properties(Vulkan::Headers PROPERTIES SYSTEM OFF)

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This deserves to be highly commented if you decide to merge this in. It's very non-obvious.

Copy link
Copy Markdown
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Done in #2001

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

macos: system header files are always used

3 participants