From d78657b706f7ad01a17398b91277d99f2f9f29cc Mon Sep 17 00:00:00 2001 From: zhaoyi233 <11971297+zhao85@users.noreply.github.com> Date: Sat, 21 May 2022 15:18:51 +0800 Subject: [PATCH] =?UTF-8?q?=E6=A3=80=E6=9F=A5sendmmsg=E7=9B=B8=E5=85=B3?= =?UTF-8?q?=E4=BE=9D=E8=B5=96=E5=B9=B6=E8=AE=BE=E7=BD=AE=E5=AF=B9=E5=BA=94?= =?UTF-8?q?=E7=9A=84=E5=AE=8F?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- CMakeLists.txt | 18 ++++++++++++++++++ 1 file changed, 18 insertions(+) diff --git a/CMakeLists.txt b/CMakeLists.txt index 8ed4356d..eb1e06f9 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -1,5 +1,23 @@ project(ZLMediaKit) 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 set(CMAKE_CXX_STANDARD 11) #加载自定义模块