@@ -27,26 +27,26 @@ function(pop_variable var)
27
27
endfunction ()
28
28
29
29
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} )
39
32
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} )
46
45
endif ()
46
+ else ()
47
+ message (FATAL_ERROR
48
+ "SPIRV-Headers was not found - please checkout a copy under external/." )
47
49
endif ()
48
- set (SPIRV_HEADER_INCLUDE_DIR ${SPIRV-Headers_INCLUDE_DIRS} PARENT_SCOPE )
49
- message (STATUS "Found SPIRV-Headers: ${SPIRV-Headers_INCLUDE_DIRS}" )
50
50
51
51
if (NOT ${SPIRV_SKIP_TESTS} )
52
52
# Find gmock if we can. If it's not already configured, then try finding
0 commit comments