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

Add cmake arg to disable warnings as errors #2595

Merged
merged 1 commit into from
Jul 26, 2023
Merged
Show file tree
Hide file tree
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
1 change: 1 addition & 0 deletions CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -63,6 +63,7 @@ if (LEGACY_BUILD)
option(DISABLE_INTERNAL_IMDSV1_CALLS "Disables IMDSv1 internal client calls" OFF)
option(BUILD_BENCHMARKS "Enables building the benchmark executable" OFF)
option(BUILD_OPTEL "Enables building the open telemetry implementation of tracing" OFF)
option(AWS_SDK_WARNINGS_ARE_ERRORS "Compiler warning is treated as an error. Try turning this off when observing errors on a new or uncommon compiler" ON)

set(AWS_USER_AGENT_CUSTOMIZATION "" CACHE STRING "User agent extension")
set(AWS_TEST_REGION "US_EAST_1" CACHE STRING "Region to target integration tests against")
Expand Down
7 changes: 5 additions & 2 deletions cmake/compiler_settings.cmake
Original file line number Diff line number Diff line change
Expand Up @@ -53,7 +53,10 @@ macro(set_gcc_flags)
endmacro()

macro(set_gcc_warnings)
list(APPEND AWS_COMPILER_WARNINGS "-Wall" "-Werror" "-pedantic" "-Wextra")
list(APPEND AWS_COMPILER_WARNINGS "-Wall" "-pedantic" "-Wextra")
if(AWS_SDK_WARNINGS_ARE_ERRORS)
list(APPEND AWS_COMPILER_WARNINGS "-Werror")
endif ()
if(COMPILER_CLANG)
if(PLATFORM_ANDROID)
# when using clang with libc and API lower than 21 we need to include Android support headers and ignore the gnu-include-next warning.
Expand Down Expand Up @@ -153,7 +156,7 @@ macro(set_msvc_warnings)
endif()

# warnings as errors, max warning level (4)
if(NOT CMAKE_CXX_FLAGS MATCHES "/WX")
if(NOT CMAKE_CXX_FLAGS MATCHES "/WX" AND AWS_SDK_WARNINGS_ARE_ERRORS)
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} /WX")
endif()

Expand Down
Loading