From ca5751590ed751fba8abaae9b345663002878865 Mon Sep 17 00:00:00 2001 From: David Neto Date: Tue, 14 Apr 2020 08:28:25 -0700 Subject: [PATCH] If SPIRV-Headers is in our tree, include it as subproject (#3299) This allows enclosing projects to use SPIRV-Headers_SOURCE_DIR to set up in header includes. --- external/CMakeLists.txt | 10 ++++++++++ 1 file changed, 10 insertions(+) diff --git a/external/CMakeLists.txt b/external/CMakeLists.txt index 8bde13ca15..3c7b40331d 100644 --- a/external/CMakeLists.txt +++ b/external/CMakeLists.txt @@ -25,7 +25,17 @@ else() endif() if (IS_DIRECTORY ${SPIRV_HEADER_DIR}) + # TODO(dneto): We should not be modifying the parent scope. set(SPIRV_HEADER_INCLUDE_DIR ${SPIRV_HEADER_DIR}/include PARENT_SCOPE) + + # 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) + set(SPIRV_HEADERS_SKIP_INSTALL ON) + set(SPIRV_HEADERS_SKIP_EXAMPLES ON) + add_subdirectory(${SPIRV_HEADER_DIR}) + endif() else() message(FATAL_ERROR "SPIRV-Headers was not found - please checkout a copy under external/.")