Skip to content

Commit 99bb50f

Browse files
committed
exclude compilers that dont support modules from compiling module.test
1 parent 17694cd commit 99bb50f

File tree

1 file changed

+10
-1
lines changed

1 file changed

+10
-1
lines changed

tests/CMakeLists.txt

Lines changed: 10 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,16 @@ FetchContent_Declare(
99
)
1010
FetchContent_MakeAvailable(Catch2)
1111

12-
set(ALL_TESTNAMES scope_success scope_exit scope_fail unique_resource module)
12+
message("Compiler is: ${CMAKE_CXX_COMPILER_ID} version: ${CMAKE_CXX_COMPILER_VERSION}")
13+
14+
# module tests will only compile with gcc15 or clang20 and above
15+
if (CMAKE_CXX_COMPILER_ID STREQUAL "Clang" AND CMAKE_CXX_COMPILER_VERSION VERSION_GREATER_EQUAL 20)
16+
set(ALL_TESTNAMES scope_success scope_exit scope_fail unique_resource module)
17+
elseif (CMAKE_CXX_COMPILER_ID STREQUAL "GNU" AND CMAKE_CXX_COMPILER_VERSION VERSION_GREATER_EQUAL 15)
18+
set(ALL_TESTNAMES scope_success scope_exit scope_fail unique_resource module)
19+
else()
20+
set(ALL_TESTNAMES scope_success scope_exit scope_fail unique_resource)
21+
endif()
1322

1423
message("Tests to be built: ${ALL_TESTNAMES}")
1524

0 commit comments

Comments
 (0)