Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Remove ADJUST_COMPILER_WARNINGS function #213

Merged
merged 2 commits into from
Oct 29, 2024
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
34 changes: 15 additions & 19 deletions cmake/compilers.cmake
Original file line number Diff line number Diff line change
Expand Up @@ -3,14 +3,16 @@ function(FIND_AND_SET_CLANG17)
find_program(CLANG_17 clang-17)

if(NOT CLANGPP_17 OR NOT CLANG_17)
message(FATAL_ERROR "Clang-17 not found. Make sure you have clang-17 and clang++-17 installed and in your PATH")
message(
FATAL_ERROR
"Clang-17 not found. Make sure you have clang-17 and clang++-17 installed and in your PATH"
)
endif()

set(CMAKE_CXX_COMPILER "${CLANGPP_17}" PARENT_SCOPE)
set(CMAKE_C_COMPILER "${CLANG_17}" PARENT_SCOPE)
endfunction()


function(CHECK_COMPILERS)
message(STATUS "Checking compilers")

Expand All @@ -20,7 +22,14 @@ function(CHECK_COMPILERS)
CACHE STRING
"CXX FLAGS for clang"
)
if(CMAKE_CXX_COMPILER_VERSION VERSION_LESS "17.0.0" OR CMAKE_CXX_COMPILER_VERSION GREATER_EQUAL "18.0.0")
if(
CMAKE_CXX_COMPILER_VERSION
VERSION_LESS
"17.0.0"
OR CMAKE_CXX_COMPILER_VERSION
GREATER_EQUAL
"18.0.0"
)
message(WARNING "Only Clang-17 is tested right now")
endif()
elseif(CMAKE_CXX_COMPILER_ID STREQUAL "GNU")
Expand All @@ -30,22 +39,9 @@ function(CHECK_COMPILERS)
message(WARNING "Only GCC-12 is tested right now")
endif()
else()
message(FATAL_ERROR "Unsupported compiler: ${CMAKE_CXX_COMPILER_ID} ! Only Clang and GCC are supported")
endif()
endfunction()


function(ADJUST_COMPILER_WARNINGS)
if(CMAKE_CXX_COMPILER_ID STREQUAL "Clang")
target_compile_options(compiler_warnings INTERFACE
-Wsometimes-uninitialized -Wno-c++11-narrowing -Wno-error=local-type-template-args
-Wno-delete-non-abstract-non-virtual-dtor -Wno-c99-designator -Wno-shift-op-parentheses -Wno-non-c-typedef-for-linkage
-Wno-deprecated-this-capture -Wno-deprecated-volatile -Wno-deprecated-builtins -Wno-deprecated-declarations
)
else() # GCC
target_compile_options(compiler_warnings INTERFACE
-Wno-deprecated -Wno-attributes -Wno-stringop-overread -Wno-stringop-overflow -Wno-maybe-uninitialized -Wno-missing-requires
-Wno-narrowing -Wno-non-template-friend -Wno-error=non-template-friend
message(
FATAL_ERROR
"Unsupported compiler: ${CMAKE_CXX_COMPILER_ID} ! Only Clang and GCC are supported"
)
endif()
endfunction()
Loading