cmake: silence -Waddress-of-packed-member warnings from SPDK

Signed-off-by: Kefu Chai <kchai@redhat.com>
This commit is contained in:
Kefu Chai 2019-06-12 21:27:33 +08:00
parent b3cac157f5
commit 764de84088

View File

@ -18,6 +18,12 @@ macro(build_spdk)
set(make_cmd "${MAKE_EXECUTABLE}")
endif()
set(spdk_CFLAGS "-fPIC")
include(CheckCCompilerFlag)
check_c_compiler_flag("-Wno-address-of-packed-member" HAS_WARNING_ADDRESS_OF_PACKED_MEMBER)
if(HAS_WARNING_ADDRESS_OF_PACKED_MEMBER)
set(spdk_CFLAGS "${spdk_CFLAGS} -Wno-address-of-packed-member")
endif()
include(ExternalProject)
ExternalProject_Add(spdk-ext
DEPENDS dpdk-ext
@ -26,7 +32,7 @@ macro(build_spdk)
# unset $CFLAGS, otherwise it will interfere with how SPDK sets
# its include directory.
# unset $LDFLAGS, otherwise SPDK will fail to mock some functions.
BUILD_COMMAND env -i PATH=$ENV{PATH} CC=${CMAKE_C_COMPILER} ${make_cmd} EXTRA_CFLAGS="-fPIC"
BUILD_COMMAND env -i PATH=$ENV{PATH} CC=${CMAKE_C_COMPILER} ${make_cmd} EXTRA_CFLAGS="${spdk_CFLAGS}"
BUILD_IN_SOURCE 1
INSTALL_COMMAND "true")
unset(make_cmd)