Skip to content

Commit cf9508f

Browse files
committed
A more inclusive handling of Catch2's use of __COUNTER__
1 parent 14e4b50 commit cf9508f

File tree

1 file changed

+3
-9
lines changed

1 file changed

+3
-9
lines changed

CMakeLists.txt

Lines changed: 3 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,7 @@ FetchContent_Declare(
1515
FetchContent_Declare(
1616
Catch2
1717
GIT_REPOSITORY https://github.com/catchorg/Catch2.git
18-
GIT_TAG v3.10.0
18+
GIT_TAG v3.13.0
1919
GIT_SHALLOW ON
2020
EXCLUDE_FROM_ALL # Do not install
2121
FIND_PACKAGE_ARGS
@@ -89,6 +89,8 @@ set(CTEST_TEST_TIMEOUT 90 CACHE STRING "Per-test timeout (s) for CTest")
8989

9090
# Make tools available
9191
FetchContent_MakeAvailable(Catch2 GSL mimicpp)
92+
# Avoid use of __COUNTER__ to prevent -pedantic warnings in Catch2's TEST_CASE macro
93+
set(CATCH_CONFIG_COUNTER OFF)
9294

9395
include(Modules/private/CreateCoverageTargets.cmake)
9496

@@ -136,14 +138,6 @@ if(CMAKE_CXX_COMPILER_ID STREQUAL "GNU")
136138
endif()
137139
endif()
138140

139-
# Catch2's TEST_CASE macro uses __COUNTER__, which Clang >= 22 flags as a C2y
140-
# extension under -pedantic. Suppress the warning to avoid -Werror failures.
141-
if(CMAKE_CXX_COMPILER_ID STREQUAL "Clang")
142-
if(CMAKE_CXX_COMPILER_VERSION VERSION_GREATER_EQUAL "22")
143-
add_compile_options(-Wno-c2y-extensions)
144-
endif()
145-
endif()
146-
147141
set(CMAKE_EXPORT_COMPILE_COMMANDS ON)
148142
set(CMAKE_INSTALL_RPATH_USE_LINK_PATH ON)
149143

0 commit comments

Comments
 (0)