Skip to content

Commit 045d1e9

Browse files
Categorize compiler flags
Categorize compiler flags based on usage and purpose. Of particular note: GCC and Clang's `-Woverloaded-virtual` are woefully bogus when the overriding function explicitly specifies `override` or `final`. Those diagnostics shouldn't fire on those scenarios.
1 parent 422179d commit 045d1e9

File tree

1 file changed

+9
-4
lines changed

1 file changed

+9
-4
lines changed

CMakeLists.txt

Lines changed: 9 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -63,18 +63,23 @@ set_target_properties(${PROJECT_NAME}
6363
)
6464

6565
target_compile_options(${PROJECT_NAME}
66-
PRIVATE
66+
PUBLIC
6767
$<$<CXX_COMPILER_ID:MSVC>:
68-
/W2 # Usual warnings
6968
/permissive- # Turn on strict language conformance
7069
/EHsc # Turn on exception handling semantics
7170
>
71+
$<$<OR:$<CXX_COMPILER_ID:GNU>,$<CXX_COMPILER_ID:Clang>>:
72+
-Wno-overloaded-virtual # Avoid bogus warnings against foundational techniques.
73+
>
74+
PRIVATE
75+
$<$<CXX_COMPILER_ID:MSVC>:
76+
/W2 # Usual warnings
77+
>
7278
$<$<OR:$<CXX_COMPILER_ID:GNU>,$<CXX_COMPILER_ID:Clang>>:
7379
-Wall # Turn on all useful warnings
7480
-pedantic # Turn on strict language conformance
75-
>
81+
>
7682
$<$<CXX_COMPILER_ID:Clang>:
77-
-Wno-overloaded-virtual # Too many false positives
7883
-Wno-delete-non-abstract-non-virtual-dtor # System headers plagued
7984
>
8085
)

0 commit comments

Comments
 (0)