Supress warnings for external sources with modules

I tried to switch to modules and was thinking about proper testing. I came up with the following layout of my project:

example
|---external
    |---googletest(checked out as a submodule)
|---src
    |---example.ixx
    |---example.common.ixx
|---tests
    |---example.test.ixx
    |---main_tests.cpp
|---CMakeLists.txt

The test file contains:

module;
#include <gtest/gtest.h>

export module example:tests;
import :common;

TEST(Test_1, Test_1_1) { EXPECT_DEBUG_DEATH(test(), ".*"); }

It is testing an assert. Naturally, I don’t want compiler warnings from external projects, which so far without modules is working. Now, when I do cmake -B build -GNinja -DCMAKE_BUILD_TYPE=Debug && cmake --build build I get warnings from gtest:

tests/example.test.ixx:7:26: warning: 'switch' missing 'default' label [-Wswitch-default]
    7 | TEST(Test_1, Test_1_1) { EXPECT_DEBUG_DEATH(test(), ".*"); }
      |                          ^
external/googletest/googletest/include/gtest/gtest-death-test.h:272:46: note: expanded from macro 'EXPECT_DEBUG_DEATH'
  272 | #define EXPECT_DEBUG_DEATH(statement, regex) EXPECT_DEATH(statement, regex)
      |                                              ^
external/googletest/googletest/include/gtest/gtest-death-test.h:190:3: note: expanded from macro 'EXPECT_DEATH'
  190 |   EXPECT_EXIT(statement, ::testing::internal::ExitedUnsuccessfully, matcher)
      |   ^
external/googletest/googletest/include/gtest/gtest-death-test.h:179:3: note: expanded from macro 'EXPECT_EXIT'
  179 |   GTEST_DEATH_TEST_(statement, predicate, matcher, GTEST_NONFATAL_FAILURE_)
      |   ^
external/googletest/googletest/include/gtest/internal/gtest-death-test-internal.h:233:7: note: expanded from macro 'GTEST_DEATH_TEST_'
  233 |       switch (gtest_dt->AssumeRole()) {                                        \
      |       ^
1 warning generated.
[28/28] Linking CXX executable tests

Here is the projects CMakeLists.txt:

cmake_minimum_required(VERSION 3.28)

set(CMAKE_CXX_STANDARD 23)
set(CMAKE_CXX_STANDARD_REQUIRED ON)
set(CMAKE_CXX_EXTENSIONS OFF)
set(CMAKE_EXPORT_COMPILE_COMMANDS ON)
set(CMAKE_CXX_SCAN_FOR_MODULES ON)

project(
  example
  VERSION 0.1.0
  DESCRIPTION "example"
  LANGUAGES CXX )

option(ENABLE_TESTS "Enable tests" ON)

add_subdirectory(external/googletest SYSTEM)

add_library(${PROJECT_NAME})
target_sources(${PROJECT_NAME}
  PUBLIC
    FILE_SET cxx_modules TYPE CXX_MODULES
    BASE_DIRS
      ${CMAKE_SOURCE_DIR}/src
      ${CMAKE_SOURCE_DIR}/tests
    FILES
      src/example.ixx
      src/example.common.ixx
)

target_compile_options(${PROJECT_NAME} PRIVATE
    -Wswitch-default
  )

if(ENABLE_TESTS)
  target_sources(${PROJECT_NAME}
    PUBLIC
      FILE_SET cxx_modules TYPE CXX_MODULES
      FILES
        tests/example.test.ixx
  )
  target_compile_definitions(${PROJECT_NAME}  PRIVATE ENABLE_TESTS)
  target_link_libraries(${PROJECT_NAME} PUBLIC GTest::gtest_main)
  set(SOURCE_FILES tests/main_tests.cpp )

  add_executable(tests ${SOURCE_FILES})

  target_include_directories(tests PUBLIC ${CMAKE_SOURCE_DIR}/src)
  target_link_libraries(tests ${PROJECT_NAME})

  include(GoogleTest)
  gtest_discover_tests(tests)
endif()

I wonder if misunderstand modules or if I did something wrong with CMake? So far, declaring the subdirectory as SYSTEM was enough without modules.