Skip to content

Commit

Permalink
Add SEASTAR_USER_CFLAGS and SEASTAR_ENABLE_WERROR
Browse files Browse the repository at this point in the history
SEASTAR_USER_CFLAGS are needed to pass CFLAGS to seastar's
DPDK fork and other C dependencies. Currently on gcc8 DPDK
checked into master branch fails because of

  -Wno-stringop-overflow
  -Wno-array-bounds
  -Wno-stringop-truncation
  -Wno-format-overflow

Some of these warnings have already been addressed upstream.
We need a way to control these flags in case we upgrade compilers
or transitive projects upgrade compilers

if SEASTAR_ENABLE_WERROR is OFF it disables -Werror.

Signed-off-by: Alexander Gallego <[email protected]>
Message-Id: <[email protected]>
  • Loading branch information
emaxerrno authored and avikivity committed Jun 25, 2018
1 parent d7f35d7 commit 0b09378
Showing 1 changed file with 16 additions and 2 deletions.
18 changes: 16 additions & 2 deletions CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -60,6 +60,8 @@ option (SEASTAR_EXCLUDE_APPS_BY_DEFAULT
"If ON, then applications are not build by default when the build tool is invoked"
ON)

option(SEASTAR_ENABLE_WERROR "If ON, add -Werror to compile flags" ON)

set (SEASTAR_CXX_DIALECT
"gnu++17"
CACHE
Expand All @@ -78,6 +80,13 @@ set (SEASTAR_USER_CXXFLAGS
STRING
"Extra CXXFLAGS, separated by semicolon.")

set (SEASTAR_USER_CFLAGS
""
CACHE
STRING
"Extra CFLAGS, separated by semicolon for DPDK submodule.")


set (SEASTAR_USER_LDFLAGS
""
CACHE
Expand Down Expand Up @@ -488,7 +497,7 @@ if (${SEASTAR_ENABLE_DPDK})
OUTPUT_VARIABLE dpdk_cflags)

add_custom_target (seastar-dpdk
COMMAND make -C ${dpdk_binary_dir} CC=\"${CMAKE_C_COMPILER} -Wno-implicit-fallthrough -Wno-format-truncation -Wno-bool-operation -Wno-maybe-uninitialized\")
COMMAND make -C ${dpdk_binary_dir} CC=\"${CMAKE_C_COMPILER} -Wno-implicit-fallthrough -Wno-format-truncation -Wno-bool-operation -Wno-maybe-uninitialized ${SEASTAR_USER_CFLAGS}\")

add_dependencies (seastar seastar-dpdk)

Expand All @@ -503,14 +512,19 @@ endif ()
target_compile_options (seastar
PRIVATE
-Wall
-Werror

PUBLIC
"-std=${SEASTAR_CXX_DIALECT}"
-Wno-error=deprecated-declarations
-fvisibility=hidden
-U_FORTIFY_SOURCE)

if(SEASTAR_ENABLE_WERROR)
target_compile_options (seastar PRIVATE
-Werror
)
endif()

if ("${CMAKE_BUILD_TYPE}" STREQUAL "Debug")
target_compile_options (seastar PUBLIC
-fsanitize=address
Expand Down

0 comments on commit 0b09378

Please sign in to comment.