Replace CMAKE_SOURCE_DIR with PROJECT_SOURCE_DIR
This allows Dawn to be used as a subdirectory of a parent CMake project.
Amend:
Replace PROJECT_SOURCE_DIR with TINT_ROOT_SOURCE_DIR
Bug: dawn:2296
Change-Id: I1f1576e9007b0b866e7be22d7556a2542a9e205a
Reviewed-on: https://dawn-review.googlesource.com/c/dawn/+/168060
Reviewed-by: Ben Clayton <bclayton@google.com>
Kokoro: Kokoro <noreply+kokoro@google.com>
Reviewed-by: dan sinclair <dsinclair@chromium.org>
Commit-Queue: Ben Clayton <bclayton@google.com>
diff --git a/src/tint/CMakeLists.txt b/src/tint/CMakeLists.txt
index 9a4eba5..eb95b38 100644
--- a/src/tint/CMakeLists.txt
+++ b/src/tint/CMakeLists.txt
@@ -690,10 +690,10 @@
install(FILES ${TINT_HEADERS} DESTINATION ${CMAKE_INSTALL_INCLUDEDIR}/tint/)
- file(GLOB_RECURSE TINT_SRC_HEADERS RELATIVE ${CMAKE_SOURCE_DIR}/src/tint/ "*.h")
+ file(GLOB_RECURSE TINT_SRC_HEADERS RELATIVE ${TINT_ROOT_SOURCE_DIR} "*.h")
foreach(TINT_HEADER_FILE ${TINT_SRC_HEADERS})
get_filename_component(TINT_HEADER_DIR ${TINT_HEADER_FILE} DIRECTORY)
- install(FILES ${CMAKE_SOURCE_DIR}/src/tint/${TINT_HEADER_FILE} DESTINATION ${CMAKE_INSTALL_INCLUDEDIR}/src/tint/${TINT_HEADER_DIR})
+ install(FILES ${TINT_ROOT_SOURCE_DIR}/${TINT_HEADER_FILE} DESTINATION ${CMAKE_INSTALL_INCLUDEDIR}/src/tint/${TINT_HEADER_DIR})
endforeach ()
endif()
diff --git a/third_party/CMakeLists.txt b/third_party/CMakeLists.txt
index 2a2cd68..6e3cdc4 100644
--- a/third_party/CMakeLists.txt
+++ b/third_party/CMakeLists.txt
@@ -178,7 +178,7 @@
set(CLANG_BUILD_EXAMPLES OFF CACHE BOOL "" FORCE)
set(CLANG_INCLUDE_TESTS OFF CACHE BOOL "" FORCE)
- set(DIRECTX_HEADER_INCLUDE_DIR "${CMAKE_SOURCE_DIR}/third_party/dxheaders/include")
+ set(DIRECTX_HEADER_INCLUDE_DIR "${PROJECT_SOURCE_DIR}/third_party/dxheaders/include")
# Disable HCT.cmake looking for and using clang-format. This is used to compare generated files
# against the copy that is committed to the repo, but fails because the DXC .clangformat file is