summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorJay Kwak <82421531+jkwak-work@users.noreply.github.com>2025-09-19 08:45:30 -0700
committerGitHub <noreply@github.com>2025-09-19 15:45:30 +0000
commit48cbbcfeb3531a819edd74e072ca3c4b4379c5a3 (patch)
treedf36f9cb61bdf90e846b7aa33dfa07e3dcba735a
parent391d35d63e83293855180b1cce061ca6b73a8b56 (diff)
Fix SPIRV headers precedence (#8481)
Remove SYSTEM flag from SPIRV-Headers to fix MacOS header precedence. When the path is registered as SYSTEM, it is used with `-isystem` option not `-I` option and it gets less searching order on MacOS. When spirv.h is installed on the system directory, it will end up using the system installed spirv.h, which is most likely an older version than we should use.
-rw-r--r--external/CMakeLists.txt8
1 files changed, 4 insertions, 4 deletions
diff --git a/external/CMakeLists.txt b/external/CMakeLists.txt
index e0dcdfb40..6b8b5a527 100644
--- a/external/CMakeLists.txt
+++ b/external/CMakeLists.txt
@@ -105,6 +105,8 @@ target_include_directories(
)
# SPIRV-Headers
+# Avoid using ${system} intentionally in `add_subdirectory`, because if we do, it will end up using
+# spirv.h installed in the system directory on MacOS.
if(NOT TARGET SPIRV-Headers)
if(SLANG_USE_SYSTEM_SPIRV_HEADERS)
if(SLANG_OVERRIDE_SPIRV_HEADERS_PATH)
@@ -118,10 +120,9 @@ if(NOT TARGET SPIRV-Headers)
${SLANG_OVERRIDE_SPIRV_HEADERS_PATH}/spirv-headers
spirv-headers
EXCLUDE_FROM_ALL
- ${system}
)
else()
- add_subdirectory(spirv-headers EXCLUDE_FROM_ALL ${system})
+ add_subdirectory(spirv-headers EXCLUDE_FROM_ALL)
endif()
endif()
@@ -205,13 +206,12 @@ if(SLANG_ENABLE_SLANG_GLSLANG)
# Tools
if(NOT SLANG_OVERRIDE_SPIRV_TOOLS_PATH)
- add_subdirectory(spirv-tools EXCLUDE_FROM_ALL ${system})
+ add_subdirectory(spirv-tools EXCLUDE_FROM_ALL)
else()
add_subdirectory(
${SLANG_OVERRIDE_SPIRV_TOOLS_PATH}/spirv-tools
spirv-tools
EXCLUDE_FROM_ALL
- ${system}
)
endif()
endif()