Revert "Fix(cmake): CMake doesn't find system installed SPIRV-Headers (#5422)" (#5517)

This reverts commit 7d2429594d.
This commit is contained in:
Steven Perron 2024-01-03 09:55:24 -05:00 committed by GitHub
parent 7d2429594d
commit 0a9f3d1f2a
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -27,26 +27,26 @@ function(pop_variable var)
endfunction() endfunction()
if (DEFINED SPIRV-Headers_SOURCE_DIR) if (DEFINED SPIRV-Headers_SOURCE_DIR)
add_subdirectory(${SPIRV-Headers_SOURCE_DIR}) # This allows flexible position of the SPIRV-Headers repo.
set(SPIRV-Headers_INCLUDE_DIRS ${SPIRV-Headers_SOURCE_DIR}/include) set(SPIRV_HEADER_DIR ${SPIRV-Headers_SOURCE_DIR})
elseif (IS_DIRECTORY ${CMAKE_CURRENT_SOURCE_DIR}/spirv-headers/)
add_subdirectory(${CMAKE_CURRENT_SOURCE_DIR}/spirv-headers/)
set(SPIRV-Headers_INCLUDE_DIRS ${CMAKE_CURRENT_SOURCE_DIR}/spirv-headers/include)
elseif(IS_DIRECTORY ${CMAKE_CURRENT_SOURCE_DIR}/SPIRV-Headers/)
add_subdirectory(${CMAKE_CURRENT_SOURCE_DIR}/SPIRV-Headers/)
set(SPIRV-Headers_INCLUDE_DIRS ${CMAKE_CURRENT_SOURCE_DIR}/SPIRV-Headers/include)
elseif()
else() else()
find_package(SPIRV-Headers QUIET) set(SPIRV_HEADER_DIR ${CMAKE_CURRENT_SOURCE_DIR}/spirv-headers)
if (SPIRV-Headers_FOUND) endif()
get_target_property(SPIRV-Headers_INCLUDE_DIRS SPIRV-Headers::SPIRV-Headers INTERFACE_INCLUDE_DIRECTORIES)
else () if (IS_DIRECTORY ${SPIRV_HEADER_DIR})
message(FATAL_ERROR # TODO(dneto): We should not be modifying the parent scope.
"SPIRV-Headers was not found - please checkout a copy under external/.") set(SPIRV_HEADER_INCLUDE_DIR ${SPIRV_HEADER_DIR}/include PARENT_SCOPE)
endif()
# Add SPIRV-Headers as a sub-project if it isn't already defined.
# Do this so enclosing projects can use SPIRV-Headers_SOURCE_DIR to find
# headers to include.
if (NOT DEFINED SPIRV-Headers_SOURCE_DIR)
add_subdirectory(${SPIRV_HEADER_DIR})
endif()
else()
message(FATAL_ERROR
"SPIRV-Headers was not found - please checkout a copy under external/.")
endif() endif()
set(SPIRV_HEADER_INCLUDE_DIR ${SPIRV-Headers_INCLUDE_DIRS} PARENT_SCOPE)
message(STATUS "Found SPIRV-Headers: ${SPIRV-Headers_INCLUDE_DIRS}")
if (NOT ${SPIRV_SKIP_TESTS}) if (NOT ${SPIRV_SKIP_TESTS})
# Find gmock if we can. If it's not already configured, then try finding # Find gmock if we can. If it's not already configured, then try finding