@@ -8,20 +8,95 @@ add_executable(tests detail/meta.cpp builder_meta.cpp callback.cpp nexus.cpp)
88if (CMAKE_CXX_COMPILER_ID STREQUAL "Clang" )
99 target_compile_options (tests
1010 PRIVATE
11- -ftemplate-backtrace-limit=0
12- -ferror-limit=2
11+ -ferror-limit=8
12+ -Weverything
13+ -Wshadow-all
14+ -Warray-bounds-pointer-arithmetic
15+
16+ -Wfor-loop-analysis
17+ -Wgcc-compat
18+ -Wglobal-constructors
19+ -Wgnu
20+ -Wheader-hygiene
21+ -Widiomatic-parentheses
22+ -Wnewline-eof
23+ -Wimplicit
1324 )
1425
26+ EXECUTE_PROCESS ( COMMAND ${CMAKE_CXX_COMPILER} --version OUTPUT_VARIABLE clang_full_version_string )
27+ string (REGEX REPLACE ".*clang version ([0-9]+\\ .[0-9]+).*" "\\ 1" CLANG_VERSION_STRING ${clang_full_version_string} )
28+
29+ if (${CLANG_VERSION_STRING} VERSION_GREATER 9.0.0)
30+ target_compile_options (tests
31+ PRIVATE
32+ -Wmisleading-indentation
33+ )
34+ endif ()
35+
36+ if (${CLANG_VERSION_STRING} VERSION_GREATER 8.0.0)
37+ target_compile_options (tests
38+ PRIVATE
39+ # this complains about many cases in which ctad is supported and intended
40+ -Wno-ctad-maybe-unsupported
41+ )
42+ endif ()
43+
44+ if (${CLANG_VERSION_STRING} VERSION_GREATER 7.0.0)
45+ target_compile_options (tests
46+ PRIVATE
47+ -Wextra-semi-stmt
48+ )
49+ endif ()
1550elseif (CMAKE_CXX_COMPILER_ID STREQUAL "GNU" )
1651 target_compile_options (tests
1752 PRIVATE
18- -ftemplate-backtrace-limit=0
19- -fmax-errors=2
53+ -fmax-errors=8
54+ -Wshadow
55+ -Wmisleading-indentation
56+
57+ # this complains about many cases in which ctad is supported and intended
58+ -Wno-ctad-maybe-unsupported
2059 )
2160endif ()
2261
62+
63+ target_compile_options (tests
64+ PRIVATE
65+ -ftemplate-backtrace-limit=0
66+ -Werror
67+ -Wpedantic
68+ -Wall
69+ -Wextra
70+ -Wextra-semi
71+ -Wformat-security
72+ -Wextra-semi
73+ -Wfloat-conversion
74+ -Wignored-qualifiers
75+ -Wold-style-cast
76+ -Wunused
77+ -Weffc++
78+
79+ # not feasible to change tuple padding for now
80+ -Wno-padded
81+
82+ # clang complains about @example, which seems to be a valid tag
83+ -Wno-documentation-unknown-command
84+
85+ # clang complains about @tparam on a template type alias
86+ -Wno-documentation
87+
88+ # compatibility with anything less than C++17 is not a goal
89+ -Wno-c++98-compat-pedantic
90+ -Wno-c++98-compat
91+ -Wno-c++11-compat
92+ -Wno-c++14-compat
93+ )
94+
2395target_link_libraries (tests PRIVATE Catch2::Catch2WithMain Cib)
2496
97+ # ensure the catch2 headers do not produce warnings
98+ target_include_directories (tests SYSTEM PUBLIC ${CMAKE_SOURCE_DIR} /lib/Catch2/src/)
99+
25100list (APPEND CMAKE_MODULE_PATH ${CMAKE_SOURCE_DIR} /lib/Catch2/extras)
26101include (CTest)
27102include (Catch)
0 commit comments