Move Abseil add_subdirectory to third_party

Handling Abseil in the root CMake is inconsistent with other dependencies, which are all handled in `third_party/CMakeLists.txt`. Moreover, it breaks the `DAWN_FETCH_DEPENDENCIES` mechanism since it tries to add Abseil before it was fetched (hence breaking the GitHub CI).

Issue was introduced by f7c65dd9e72861d3bf9f327aa6fbb774eeeb8746

This is an imported pull request from
https://github.com/google/dawn/pull/35

GITHUB_PR_HEAD_SHA=7d7a6a2e2fec3e5c7e23fc94b2414a3510f200aa
ORIGINAL_AUTHOR=Elie Michel <eliemichel@users.noreply.github.com>
GitOrigin-RevId: 7fe2a98f16232fff73c1879d354b0311cf94d048
Change-Id: Ica2c7fdf3e2b6709c06895cb44c07821bdf1442a
Reviewed-on: https://dawn-review.googlesource.com/c/dawn/+/239914
Reviewed-by: dan sinclair <dsinclair@chromium.org>
Commit-Queue: dan sinclair <dsinclair@chromium.org>
Reviewed-by: Corentin Wallez <cwallez@chromium.org>
Reviewed-by: Ryan Harrison <rharrison@chromium.org>
diff --git a/CMakeLists.txt b/CMakeLists.txt
index 9ce9f3d..48566fe 100644
--- a/CMakeLists.txt
+++ b/CMakeLists.txt
@@ -439,35 +439,10 @@
 ################################################################################
 # Run on all subdirectories
 ################################################################################
-# Needed by protobuf and other dependencies in third_party
-set(ABSL_ROOT_DIR ${DAWN_ABSEIL_DIR})
-if (NOT TARGET absl::strings)
-    # Recommended setting for compatibility with future abseil releases.
-    set(ABSL_PROPAGATE_CXX_STD ON CACHE BOOL "" FORCE)
-    message(STATUS "Dawn: using Abseil at ${DAWN_ABSEIL_DIR}")
-    if (("${CMAKE_CXX_COMPILER_ID}" STREQUAL "Clang") OR
-        ("${CMAKE_CXX_COMPILER_ID}" STREQUAL "AppleClang"))
-        add_compile_options(
-            -Wno-array-parameter
-            -Wno-deprecated-builtins
-            -Wno-unknown-warning-option
-            -Wno-gcc-compat
-            -Wno-unreachable-code-break
-            -Wno-nullability-extension
-            -Wno-shadow
-        )
-    endif()
-
-    add_subdirectory(${DAWN_ABSEIL_DIR} "${CMAKE_CURRENT_BINARY_DIR}/abseil")
-endif()
-
 if (DAWN_BUILD_PROTOBUF AND EXISTS "${DAWN_PROTOBUF_DIR}/cmake")
   if (("${CMAKE_CXX_COMPILER_ID}" STREQUAL "Clang") AND WIN32)
     set(protobuf_HAVE_BUILTIN_ATOMICS 1)
   endif()
-
-  # Needs to come before SPIR-V Tools
-  include("third_party/protobuf.cmake")
 endif()
 
 add_subdirectory(third_party)
diff --git a/third_party/CMakeLists.txt b/third_party/CMakeLists.txt
index e0f8002..4df8663 100644
--- a/third_party/CMakeLists.txt
+++ b/third_party/CMakeLists.txt
@@ -69,6 +69,32 @@
     add_subdirectory(${DAWN_GOOGLETEST_DIR} "${CMAKE_CURRENT_BINARY_DIR}/googletest" EXCLUDE_FROM_ALL)
 endif()
 
+set(ABSL_ROOT_DIR ${DAWN_ABSEIL_DIR})
+if (NOT TARGET absl::strings)
+    # Recommended setting for compatibility with future abseil releases.
+    set(ABSL_PROPAGATE_CXX_STD ON CACHE BOOL "" FORCE)
+    message(STATUS "Dawn: using Abseil at ${DAWN_ABSEIL_DIR}")
+    if (("${CMAKE_CXX_COMPILER_ID}" STREQUAL "Clang") OR
+        ("${CMAKE_CXX_COMPILER_ID}" STREQUAL "AppleClang"))
+        add_compile_options(
+            -Wno-array-parameter
+            -Wno-deprecated-builtins
+            -Wno-unknown-warning-option
+            -Wno-gcc-compat
+            -Wno-unreachable-code-break
+            -Wno-nullability-extension
+            -Wno-shadow
+        )
+    endif()
+
+    add_subdirectory(${DAWN_ABSEIL_DIR} "${CMAKE_CURRENT_BINARY_DIR}/abseil")
+endif()
+
+if (DAWN_BUILD_PROTOBUF AND EXISTS "${DAWN_PROTOBUF_DIR}/cmake")
+  # Needs to come before SPIR-V Tools
+  include("third_party/protobuf.cmake")
+endif()
+
 ################################################################################
 # End of Emscripten enabled third party directories
 ################################################################################