-
Notifications
You must be signed in to change notification settings - Fork 4
/
Copy pathCMakeLists.txt
36 lines (27 loc) · 955 Bytes
/
CMakeLists.txt
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
cmake_minimum_required(VERSION 3.8)
project(RDMA-examples)
# 设置C语言版本
set(CMAKE_C_STANDARD 11)
# 设置优化选项
set(CMAKE_C_FLAGS "-O2")
# 设置-flto
set(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -flto")
include(CheckCCompilerFlag)
CHECK_C_COMPILER_FLAG("-march=native" COMPILER_SUPPORTS_MARCH_NATIVE)
if (COMPILER_SUPPORTS_MARCH_NATIVE)
set(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -march=native")
endif ()
CHECK_C_COMPILER_FLAG("-mtune=native" COMPILER_SUPPORTS_MTUNE_NATIVE)
if (COMPILER_SUPPORTS_MTUNE_NATIVE)
set(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -mtune=native")
endif ()
# 引入rdmacm库
find_library(RDMACM_LIB rdmacm)
# 引入libibverbs库
find_library(IBVERBS_LIB ibverbs)
# 头文件目录
include_directories(include)
add_executable(client src/client.c src/utils.c)
target_link_libraries(client ${RDMACM_LIB} ${IBVERBS_LIB})
add_executable(server src/server.c src/utils.c)
target_link_libraries(server ${RDMACM_LIB} ${IBVERBS_LIB})