检查sendmmsg相关依赖并设置对应的宏

This commit is contained in:
zhaoyi233 2022-05-21 15:18:51 +08:00 committed by GitHub
parent b0f0bdb6ae
commit d78657b706
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -1,5 +1,23 @@
project(ZLMediaKit) project(ZLMediaKit)
cmake_minimum_required(VERSION 3.1.3) cmake_minimum_required(VERSION 3.1.3)
include(CheckStructHasMember)
include(CheckSymbolExists)
# sendmmsg
list(APPEND CMAKE_REQUIRED_DEFINITIONS -D_GNU_SOURCE)
check_struct_has_member("struct mmsghdr" msg_hdr sys/socket.h HAVE_MMSG_HDR)
check_symbol_exists(sendmmsg sys/socket.h HAVE_SENDMMSG_API)
check_symbol_exists(recvmmsg sys/socket.h HAVE_RECVMMSG_API)
if(HAVE_MMSG_HDR)
add_definitions(-DHAVE_MMSG_HDR)
endif()
if(HAVE_SENDMMSG_API)
add_definitions(-DHAVE_SENDMMSG_API)
endif()
if(HAVE_RECVMMSG_API)
add_definitions(-DHAVE_RECVMMSG_API)
endif()
#使c++11 #使c++11
set(CMAKE_CXX_STANDARD 11) set(CMAKE_CXX_STANDARD 11)
# #