Skip to content

Commit

Permalink
Add Clang compiler flags
Browse files Browse the repository at this point in the history
Signed-off-by: Ferry Huberts <[email protected]>
  • Loading branch information
fhuberts committed Sep 2, 2023
1 parent 485c464 commit 97452f0
Showing 1 changed file with 52 additions and 0 deletions.
52 changes: 52 additions & 0 deletions cmake/compiler-flags.cmake
Original file line number Diff line number Diff line change
Expand Up @@ -104,6 +104,10 @@ if (CMAKE_CXX_COMPILER_ID MATCHES GNU)
add_compiler_flags(4.6 "-Wextra")
endif (CMAKE_CXX_COMPILER_ID MATCHES GNU)

if (CMAKE_CXX_COMPILER_ID MATCHES "Clang")
add_compiler_flags(10 "-Weverything")
endif (CMAKE_CXX_COMPILER_ID MATCHES "Clang")


#
# Preserve debug information flags
Expand All @@ -112,6 +116,10 @@ if (CMAKE_CXX_COMPILER_ID MATCHES GNU)
add_compiler_flags(4.6 "-g3")
endif (CMAKE_CXX_COMPILER_ID MATCHES GNU)

if (CMAKE_CXX_COMPILER_ID MATCHES "Clang")
add_compiler_flags(10 "-g3")
endif (CMAKE_CXX_COMPILER_ID MATCHES "Clang")


#
# C/C++ Warning Flags
Expand Down Expand Up @@ -273,6 +281,50 @@ if (CMAKE_CXX_COMPILER_ID MATCHES GNU)
add_compiler_flags(9.1 "-Wno-pessimizing-move")
endif (CMAKE_CXX_COMPILER_ID MATCHES GNU)

if (CMAKE_CXX_COMPILER_ID MATCHES "Clang")
add_compiler_flags(14 "-Wno-c++14-attribute-extensions")
add_compiler_flags(10 "-Wno-c++14-extensions")
add_compiler_flags(10 "-Wno-c++98-compat")
add_compiler_flags(10 "-Wno-c++98-compat-pedantic")
add_compiler_flags(10 "-Wno-conditional-uninitialized")
add_compiler_flags(10 "-Wno-covered-switch-default")
add_compiler_flags(10 "-Wno-delete-non-abstract-non-virtual-dtor")
add_compiler_flags(10 "-Wno-deprecated-copy-dtor")
add_compiler_flags(14 "-Wno-deprecated-copy-with-user-provided-dtor")
add_compiler_flags(10 "-Wno-documentation")
add_compiler_flags(10 "-Wno-documentation-unknown-command")
add_compiler_flags(10 "-Wno-exit-time-destructors")
add_compiler_flags(10 "-Wno-extra-semi")
add_compiler_flags(10 "-Wno-extra-semi-stmt")
add_compiler_flags(10 "-Wno-float-equal")
add_compiler_flags(10 "-Wno-format-nonliteral")
add_compiler_flags(10 "-Wno-global-constructors")
add_compiler_flags(10 "-Wno-gnu-zero-variadic-macro-arguments")
add_compiler_flags(10 "-Wno-implicit-int-conversion")
add_compiler_flags(10 "-Wno-inconsistent-missing-destructor-override")
add_compiler_flags(10 "-Wno-newline-eof")
add_compiler_flags(10 "-Wno-non-virtual-dtor")
add_compiler_flags(10 "-Wno-padded")
add_compiler_flags(10 "-Wno-pessimizing-move")
add_compiler_flags(99 "-Wno-return-std-move-in-c++11")
add_compiler_flags(10 "-Wno-reserved-id-macro")
add_compiler_flags(14 "-Wno-reserved-identifier")
add_compiler_flags(10 "-Wno-shadow")
add_compiler_flags(10 "-Wno-sign-conversion")
add_compiler_flags(10 "-Wno-string-conversion")
add_compiler_flags(14 "-Wno-suggest-destructor-override")
add_compiler_flags(10 "-Wno-unknown-warning-option")
add_compiler_flags(10 "-Wno-unneeded-member-function")
add_compiler_flags(10 "-Wno-unreachable-code-return")
add_compiler_flags(10 "-Wno-unsafe-buffer-usage")
add_compiler_flags(10 "-Wno-unused-exception-parameter")
add_compiler_flags(10 "-Wno-unused-lambda-capture")
add_compiler_flags(10 "-Wno-unused-member-function")
add_compiler_flags(10 "-Wno-unused-parameter")
add_compiler_flags(10 "-Wno-unused-template")
add_compiler_flags(10 "-Wno-weak-vtables")
endif (CMAKE_CXX_COMPILER_ID MATCHES "Clang")


#
# Sanitize flags
Expand Down

0 comments on commit 97452f0

Please sign in to comment.