Enable compiler warnings in fuzztest targets

Pass the SYSTEM argument to add_subdirectory(ext/fuzztest) to treat
FuzzTest headers as system headers. This suppresses compiler warnings in
FuzzTest headers.

Require cmake 3.25 for AVIF_LOCAL_FUZZTEST.

Fix https://github.com/AOMediaCodec/libavif/issues/2350.
diff --git a/CMakeLists.txt b/CMakeLists.txt
index b8ad48f..c31f14e 100644
--- a/CMakeLists.txt
+++ b/CMakeLists.txt
@@ -140,9 +140,10 @@
 option(AVIF_ENABLE_FUZZTEST "Build avif fuzztest targets. Requires Google FuzzTest. Has no effect unless AVIF_BUILD_TESTS is ON."
        OFF
 )
-option(AVIF_LOCAL_FUZZTEST
-       "Build the Google FuzzTest framework by providing your own copy of the repo in ext/fuzztest (see Local Builds in README)"
-       OFF
+option(
+    AVIF_LOCAL_FUZZTEST
+    "Build the Google FuzzTest framework by providing your own copy of the repo in ext/fuzztest (see Local Builds in README). CMake must be at least 3.25."
+    OFF
 )
 
 # Whether the libavif library uses c++ indirectly (e.g. through linking to libyuv).
diff --git a/tests/CMakeLists.txt b/tests/CMakeLists.txt
index 22ced3d..ec972df 100644
--- a/tests/CMakeLists.txt
+++ b/tests/CMakeLists.txt
@@ -184,10 +184,7 @@
     macro(add_avif_fuzztest TEST_NAME)
         add_executable(${TEST_NAME} gtest/${TEST_NAME}.cc gtest/avif_fuzztest_helpers.cc ${ARGN})
         # FuzzTest bundles GoogleTest so no need to link to gtest librairies.
-        # NOTE: FuzzTest and Abseil headers have compiler warnings (mostly
-        # -Wsign-compare and some -Wunused-parameter and -Wshorten-64-to-32),
-        # so we don't enable compiler warnings on the fuzztest targets.
-        target_link_libraries(${TEST_NAME} PRIVATE aviftest_helpers_internal)
+        target_link_libraries(${TEST_NAME} PRIVATE aviftest_helpers_internal avif_enable_warnings)
         link_fuzztest(${TEST_NAME})
         add_test(NAME ${TEST_NAME} COMMAND ${TEST_NAME})
         set_property(TEST ${TEST_NAME} PROPERTY ENVIRONMENT "TEST_DATA_DIRS=${CMAKE_CURRENT_SOURCE_DIR}/data/")
@@ -201,7 +198,13 @@
         #   FUZZTEST_REPLAY=/path/to/repro_file.test
         # and running one of the targets below.
         # See https://github.com/google/fuzztest/blob/main/doc/quickstart-cmake.md
-        add_subdirectory(${AVIF_SOURCE_DIR}/ext/fuzztest ${AVIF_SOURCE_DIR}/ext/fuzztest/build.libavif EXCLUDE_FROM_ALL)
+        # Note: There are compiler warnings in the FuzzTest headers. Add the
+        # ext/fuzztest subdirectory with the SYSTEM directory property set to
+        # true so that warnings in its headers are suppressed.
+        if(CMAKE_VERSION VERSION_LESS 3.25.0)
+            message(FATAL_ERROR "CMake must be at least 3.25 to pass the SYSTEM argument to add_subdirectory(), bailing out")
+        endif()
+        add_subdirectory(${AVIF_SOURCE_DIR}/ext/fuzztest ${AVIF_SOURCE_DIR}/ext/fuzztest/build.libavif EXCLUDE_FROM_ALL SYSTEM)
     else()
         message(
             FATAL_ERROR