Tests/RunCMake/CXXModules: require transitive usages

Clang 17 is in a transition where it warns about transitive usages. Turn
it into an error if the flag is available to make sure we're testing the
feature properly.
This commit is contained in:
Ben Boeckel
2023-07-02 16:11:54 -04:00
committed by Brad King
parent e39b6ebc19
commit 71f1483aac
2 changed files with 9 additions and 1 deletions

View File

@@ -1,4 +1,4 @@
CMake Warning \(dev\) at CMakeLists.txt:7 \(target_sources\):
CMake Warning \(dev\) at CMakeLists.txt:15 \(target_sources\):
CMake's C\+\+ module support is experimental. It is meant only for
experimentation and feedback to CMake developers.
This warning is for project developers. Use -Wno-dev to suppress it.

View File

@@ -3,6 +3,14 @@ project(cxx_modules_deep_chain CXX)
include("${CMAKE_SOURCE_DIR}/../cxx-modules-rules.cmake")
if (CMAKE_CXX_COMPILER_ID MATCHES "Clang")
include(CheckCompilerFlag)
check_compiler_flag(CXX "-Wread-modules-implicitly" have_implicit_module_warning)
if (have_implicit_module_warning)
add_compile_options(-Werror=read-modules-implicitly)
endif ()
endif ()
add_library(a STATIC)
target_sources(a
PUBLIC