Tests/RunCMake/CXXModules: add a test with circular imports
The build should fail. However, the error message is completely generator-dependent as it is the build tool which (should) eventually detect this case.
This commit is contained in:
parent
7629a1182c
commit
e67f5d41af
@ -120,7 +120,9 @@ function (run_cxx_module_test directory)
|
||||
if (RunCMake_CXXModules_INSTALL)
|
||||
run_cmake_command("examples/${test_name}-install" "${CMAKE_COMMAND}" --build . --target install --config Debug)
|
||||
endif ()
|
||||
run_cmake_command("examples/${test_name}-test" "${CMAKE_CTEST_COMMAND}" -C Debug --output-on-failure)
|
||||
if (NOT RunCMake_CXXModules_NO_TEST)
|
||||
run_cmake_command("examples/${test_name}-test" "${CMAKE_CTEST_COMMAND}" -C Debug --output-on-failure)
|
||||
endif ()
|
||||
endfunction ()
|
||||
|
||||
string(REPLACE "," ";" CMake_TEST_MODULE_COMPILATION "${CMake_TEST_MODULE_COMPILATION}")
|
||||
@ -132,6 +134,9 @@ if ("named" IN_LIST CMake_TEST_MODULE_COMPILATION)
|
||||
run_cxx_module_test(generated)
|
||||
run_cxx_module_test(public-req-private)
|
||||
run_cxx_module_test(deep-chain)
|
||||
set(RunCMake_CXXModules_NO_TEST 1)
|
||||
run_cxx_module_test(circular)
|
||||
unset(RunCMake_CXXModules_NO_TEST)
|
||||
endif ()
|
||||
|
||||
# Tests which use named modules in shared libraries.
|
||||
|
@ -0,0 +1 @@
|
||||
1
|
@ -0,0 +1 @@
|
||||
(Ninja generators)?(build stopped: dependency cycle:)
|
9
Tests/RunCMake/CXXModules/examples/circular-stderr.txt
Normal file
9
Tests/RunCMake/CXXModules/examples/circular-stderr.txt
Normal file
@ -0,0 +1,9 @@
|
||||
CMake Warning \(dev\) at CMakeLists.txt:7 \(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.
|
||||
|
||||
CMake Warning \(dev\):
|
||||
C\+\+20 modules support via CMAKE_EXPERIMENTAL_CXX_MODULE_DYNDEP is
|
||||
experimental. It is meant only for compiler developers to try.
|
||||
This warning is for project developers. Use -Wno-dev to suppress it.
|
15
Tests/RunCMake/CXXModules/examples/circular/CMakeLists.txt
Normal file
15
Tests/RunCMake/CXXModules/examples/circular/CMakeLists.txt
Normal file
@ -0,0 +1,15 @@
|
||||
cmake_minimum_required(VERSION 3.24)
|
||||
project(cxx_modules_circular CXX)
|
||||
|
||||
include("${CMAKE_SOURCE_DIR}/../cxx-modules-rules.cmake")
|
||||
|
||||
add_library(circular STATIC)
|
||||
target_sources(circular
|
||||
PUBLIC
|
||||
FILE_SET CXX_MODULES
|
||||
BASE_DIRS
|
||||
"${CMAKE_CURRENT_SOURCE_DIR}"
|
||||
FILES
|
||||
circular-a.cppm
|
||||
circular-b.cppm)
|
||||
target_compile_features(circular PUBLIC cxx_std_20)
|
@ -0,0 +1,6 @@
|
||||
export module a;
|
||||
import b;
|
||||
|
||||
export int a() {
|
||||
return b();
|
||||
}
|
@ -0,0 +1,6 @@
|
||||
export module b;
|
||||
import a;
|
||||
|
||||
export int b() {
|
||||
return a();
|
||||
}
|
Loading…
Reference in New Issue
Block a user