Skip to content

Commit 0a9f3d1

Browse files
authored
Revert "Fix(cmake): CMake doesn't find system installed SPIRV-Headers (KhronosGroup#5422)" (KhronosGroup#5517)
This reverts commit 7d24295.
1 parent 7d24295 commit 0a9f3d1

File tree

1 file changed

+17
-17
lines changed

1 file changed

+17
-17
lines changed

external/CMakeLists.txt

Lines changed: 17 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -27,26 +27,26 @@ function(pop_variable var)
2727
endfunction()
2828

2929
if (DEFINED SPIRV-Headers_SOURCE_DIR)
30-
add_subdirectory(${SPIRV-Headers_SOURCE_DIR})
31-
set(SPIRV-Headers_INCLUDE_DIRS ${SPIRV-Headers_SOURCE_DIR}/include)
32-
elseif (IS_DIRECTORY ${CMAKE_CURRENT_SOURCE_DIR}/spirv-headers/)
33-
add_subdirectory(${CMAKE_CURRENT_SOURCE_DIR}/spirv-headers/)
34-
set(SPIRV-Headers_INCLUDE_DIRS ${CMAKE_CURRENT_SOURCE_DIR}/spirv-headers/include)
35-
elseif(IS_DIRECTORY ${CMAKE_CURRENT_SOURCE_DIR}/SPIRV-Headers/)
36-
add_subdirectory(${CMAKE_CURRENT_SOURCE_DIR}/SPIRV-Headers/)
37-
set(SPIRV-Headers_INCLUDE_DIRS ${CMAKE_CURRENT_SOURCE_DIR}/SPIRV-Headers/include)
38-
elseif()
30+
# This allows flexible position of the SPIRV-Headers repo.
31+
set(SPIRV_HEADER_DIR ${SPIRV-Headers_SOURCE_DIR})
3932
else()
40-
find_package(SPIRV-Headers QUIET)
41-
if (SPIRV-Headers_FOUND)
42-
get_target_property(SPIRV-Headers_INCLUDE_DIRS SPIRV-Headers::SPIRV-Headers INTERFACE_INCLUDE_DIRECTORIES)
43-
else ()
44-
message(FATAL_ERROR
45-
"SPIRV-Headers was not found - please checkout a copy under external/.")
33+
set(SPIRV_HEADER_DIR ${CMAKE_CURRENT_SOURCE_DIR}/spirv-headers)
34+
endif()
35+
36+
if (IS_DIRECTORY ${SPIRV_HEADER_DIR})
37+
# TODO(dneto): We should not be modifying the parent scope.
38+
set(SPIRV_HEADER_INCLUDE_DIR ${SPIRV_HEADER_DIR}/include PARENT_SCOPE)
39+
40+
# Add SPIRV-Headers as a sub-project if it isn't already defined.
41+
# Do this so enclosing projects can use SPIRV-Headers_SOURCE_DIR to find
42+
# headers to include.
43+
if (NOT DEFINED SPIRV-Headers_SOURCE_DIR)
44+
add_subdirectory(${SPIRV_HEADER_DIR})
4645
endif()
46+
else()
47+
message(FATAL_ERROR
48+
"SPIRV-Headers was not found - please checkout a copy under external/.")
4749
endif()
48-
set(SPIRV_HEADER_INCLUDE_DIR ${SPIRV-Headers_INCLUDE_DIRS} PARENT_SCOPE)
49-
message(STATUS "Found SPIRV-Headers: ${SPIRV-Headers_INCLUDE_DIRS}")
5050

5151
if (NOT ${SPIRV_SKIP_TESTS})
5252
# Find gmock if we can. If it's not already configured, then try finding

0 commit comments

Comments
 (0)