Skip to content
52 changes: 28 additions & 24 deletions external/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -82,16 +82,18 @@ if(NOT ${SLANG_USE_SYSTEM_LZ4})
endif()

# Vulkan headers
if(NOT ${SLANG_USE_SYSTEM_VULKAN_HEADERS})
if(NOT SLANG_OVERRIDE_VULKAN_HEADERS_PATH)
add_subdirectory(vulkan EXCLUDE_FROM_ALL ${system})
else()
add_subdirectory(
${SLANG_OVERRIDE_VULKAN_HEADERS_PATH}/vulkan
vulkan
EXCLUDE_FROM_ALL
${system}
)
if(NOT TARGET Vulkan::Headers)
if(NOT ${SLANG_USE_SYSTEM_VULKAN_HEADERS})
if(NOT SLANG_OVERRIDE_VULKAN_HEADERS_PATH)
add_subdirectory(vulkan EXCLUDE_FROM_ALL ${system})
else()
add_subdirectory(
${SLANG_OVERRIDE_VULKAN_HEADERS_PATH}/vulkan
vulkan
EXCLUDE_FROM_ALL
${system}
)
endif()
endif()
endif()

Expand All @@ -103,22 +105,24 @@ target_include_directories(
)

# SPIRV-Headers
if(SLANG_USE_SYSTEM_SPIRV_HEADERS)
if(SLANG_OVERRIDE_SPIRV_HEADERS_PATH)
message(
WARNING
"SLANG_OVERRIDE_SPIRV_HEADERS_PATH does nothing when SLANG_USE_SPIRV_HEADERS is set"
if(NOT TARGET SPIRV-Headers)
if(SLANG_USE_SYSTEM_SPIRV_HEADERS)
if(SLANG_OVERRIDE_SPIRV_HEADERS_PATH)
message(
WARNING
"SLANG_OVERRIDE_SPIRV_HEADERS_PATH does nothing when SLANG_USE_SPIRV_HEADERS is set"
)
Comment on lines +109 to +114
Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

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

I think this should be an error so that the user can fix it right away.

And from the naming perspective, "override" sounds like it could/should override SLANG_USE_SYSTEM_SPIRV_HEADERS; not the other way around.
But it wouldn't matter if it is an error and the build stops here.

endif()
elseif(SLANG_OVERRIDE_SPIRV_HEADERS_PATH)
add_subdirectory(
${SLANG_OVERRIDE_SPIRV_HEADERS_PATH}/spirv-headers
spirv-headers
EXCLUDE_FROM_ALL
${system}
)
else()
add_subdirectory(spirv-headers EXCLUDE_FROM_ALL ${system})
endif()
elseif(SLANG_OVERRIDE_SPIRV_HEADERS_PATH)
add_subdirectory(
${SLANG_OVERRIDE_SPIRV_HEADERS_PATH}/spirv-headers
spirv-headers
EXCLUDE_FROM_ALL
${system}
)
else()
add_subdirectory(spirv-headers EXCLUDE_FROM_ALL ${system})
endif()

if(SLANG_ENABLE_SLANG_GLSLANG)
Expand Down
Loading