CMake: Fix build when DAWN_BUILD_EXAMPLES=0

glfw is used by several `src/utils/*.cpp` files, regardless of whether examples are being built or not.

Change-Id: Iba90fbf96e254979c72acf792af3cb86d889f5db
Reviewed-on: https://dawn-review.googlesource.com/c/dawn/+/64742
Reviewed-by: Austin Eng <enga@chromium.org>
Reviewed-by: Corentin Wallez <cwallez@chromium.org>
Commit-Queue: Ben Clayton <bclayton@google.com>
diff --git a/third_party/CMakeLists.txt b/third_party/CMakeLists.txt
index a5e0a24..c5e36ca 100644
--- a/third_party/CMakeLists.txt
+++ b/third_party/CMakeLists.txt
@@ -38,16 +38,16 @@
     add_subdirectory(${DAWN_SPIRV_TOOLS_DIR})
 endif()
 
+if (NOT TARGET glfw)
+    set(GLFW_BUILD_DOCS OFF CACHE BOOL "" FORCE)
+    set(GLFW_BUILD_TESTS OFF CACHE BOOL "" FORCE)
+    set(GLFW_BUILD_EXAMPLES OFF CACHE BOOL "" FORCE)
+
+    message(STATUS "Dawn: using GLFW at ${DAWN_GLFW_DIR}")
+    add_subdirectory(${DAWN_GLFW_DIR})
+endif()
+
 if (DAWN_BUILD_EXAMPLES)
-    if (NOT TARGET glfw)
-        set(GLFW_BUILD_DOCS OFF CACHE BOOL "" FORCE)
-        set(GLFW_BUILD_TESTS OFF CACHE BOOL "" FORCE)
-        set(GLFW_BUILD_EXAMPLES OFF CACHE BOOL "" FORCE)
-
-        message(STATUS "Dawn: using GLFW at ${DAWN_GLFW_DIR}")
-        add_subdirectory(${DAWN_GLFW_DIR})
-    endif()
-
     if (NOT TARGET glm)
         message(STATUS "Dawn: using GLM at ${DAWN_GLM_DIR}")
         add_subdirectory(${DAWN_GLM_DIR})