Skip to content

Commit

Permalink
Use CMake flag for -Werror (#1444)
Browse files Browse the repository at this point in the history
This allows us to override it when used in tandem with
OQS_STRICT_WARNINGS.

Closes #1432
  • Loading branch information
thomwiggers authored Apr 26, 2023
1 parent 871f9e2 commit 9cf9e10
Showing 1 changed file with 5 additions and 2 deletions.
7 changes: 5 additions & 2 deletions .CMake/compiler_opts.cmake
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,11 @@
include(CheckCCompilerFlag)
check_c_compiler_flag("-Wa,--noexecstack" CC_SUPPORTS_WA_NOEXECSTACK)

# This sets the equivalent of -Werror for supported compilers
# it can be overriden with --compile-no-warnings-as-errors
# https://cmake.org/cmake/help/latest/prop_tgt/COMPILE_WARNING_AS_ERROR.html
set(CMAKE_COMPILE_WARNING_AS_ERROR ${OQS_STRICT_WARNINGS})

if(${CMAKE_VERSION} VERSION_GREATER_EQUAL "3.18")
include(CheckLinkerFlag)
check_linker_flag(C "-Wl,-z,noexecstack" LD_SUPPORTS_WL_Z_NOEXECSTACK)
Expand Down Expand Up @@ -87,7 +92,6 @@ endif()

if(CMAKE_C_COMPILER_ID MATCHES "Clang")
if(${OQS_STRICT_WARNINGS})
add_compile_options(-Werror)
add_compile_options(-Wall)
add_compile_options(-Wextra)
add_compile_options(-Wpedantic)
Expand Down Expand Up @@ -141,7 +145,6 @@ if(CMAKE_C_COMPILER_ID MATCHES "Clang")

elseif(CMAKE_C_COMPILER_ID STREQUAL "GNU")
if(${OQS_STRICT_WARNINGS})
add_compile_options(-Werror)
add_compile_options(-Wall)
add_compile_options(-Wextra)
add_compile_options(-Wpedantic)
Expand Down

0 comments on commit 9cf9e10

Please # to comment.