Fix CMake dependencies after the touch of generated files.

The empty placeholder files for generated files could have an access
time newer than all of their dependencies and not be generated. Fix this
by touching the generator script after creating the placeholder file.

The switch to interface libraries was using INTERFACE sources which made
CMake assume it could generate the files whenever, make them PUBLIC
instead so that the files are generated before any target using the
DawnJSONGenerator target.

Bug: None
Change-Id: Iac5db58204249af8eebbef30190e557b20c3f646
Reviewed-on: https://dawn-review.googlesource.com/c/dawn/+/181460
Commit-Queue: Austin Eng <enga@chromium.org>
Auto-Submit: Corentin Wallez <cwallez@chromium.org>
Reviewed-by: Austin Eng <enga@chromium.org>
diff --git a/generator/CMakeLists.txt b/generator/CMakeLists.txt
index d578283..aca1d28 100644
--- a/generator/CMakeLists.txt
+++ b/generator/CMakeLists.txt
@@ -115,6 +115,9 @@
             string(SUBSTRING "${path}" 0 ${foundIndex} dir)
             file(MAKE_DIRECTORY ${dir})
             file(TOUCH ${path})
+            # Also touch the generator script to make a dependency of the generated file dirty,
+            # ensuring that it gets generated and not used while it is an empty file.
+            file(TOUCH ${G_SCRIPT})
         endif()
     endforeach()
 
diff --git a/src/dawn/CMakeLists.txt b/src/dawn/CMakeLists.txt
index 4d8ec04..9b0ed37 100644
--- a/src/dawn/CMakeLists.txt
+++ b/src/dawn/CMakeLists.txt
@@ -78,7 +78,7 @@
 )
 
 add_library(dawn_headers INTERFACE)
-target_sources(dawn_headers INTERFACE
+target_sources(dawn_headers PUBLIC
     "${DAWN_INCLUDE_DIR}/webgpu/webgpu.h"
     ${DAWN_HEADERS_GEN_SOURCES}
 )
@@ -96,8 +96,7 @@
 )
 
 add_library(dawncpp_headers INTERFACE)
-target_sources(dawncpp_headers
-  INTERFACE
+target_sources(dawncpp_headers PUBLIC
     "${DAWN_INCLUDE_DIR}/webgpu/webgpu_cpp.h"
     "${DAWN_INCLUDE_DIR}/webgpu/webgpu_enum_class_bitmasks.h"
     ${DAWNCPP_HEADERS_GEN_SOURCES}