-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathCMakeLists.txt
44 lines (38 loc) · 1.25 KB
/
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
37
38
39
40
41
42
43
44
CMAKE_MINIMUM_REQUIRED(VERSION 2.8.12)
if (POLICY CMP0025)
# detect Apple's Clang
cmake_policy(SET CMP0025 NEW)
endif ()
if (POLICY CMP0054)
cmake_policy(SET CMP0054 NEW)
endif ()
set(LIB_MAJOR_VERSION "0")
set(LIB_MINOR_VERSION "1")
set(LIB_PATCH_VERSION "0")
set(LIB_VERSION_STRING "${LIB_MAJOR_VERSION}.${LIB_MINOR_VERSION}.${LIB_PATCH_VERSION}")
if (CMAKE_VERSION VERSION_LESS 3.0)
PROJECT(apis CXX)
else ()
cmake_policy(SET CMP0048 NEW)
PROJECT(apis VERSION "${LIB_VERSION_STRING}" LANGUAGES C CXX)
endif ()
# Protobuf
find_package(Protobuf REQUIRED)
if (Protobuf_FOUND)
message(STATUS "Protobuf_VERSION = ${Protobuf_VERSION}")
message(STATUS "Protobuf_INCLUDE_DIRS = ${Protobuf_INCLUDE_DIRS}")
message(STATUS "Protobuf_LIBRARY = ${Protobuf_LIBRARY}")
message("")
endif ()
# gRPC
set(gRPC_SSL_PROVIDER package)
find_package(gRPC CONFIG REQUIRED)
if (gRPC_FOUND)
message(STATUS "gRPC_VERSION = ${gRPC_VERSION}")
message("")
endif ()
file(GLOB_RECURSE HEADER_FILES src/apis/*.h)
file(GLOB_RECURSE SRC_FILES src/apis/*.cc)
add_library(${PROJECT_NAME} ${SRC_FILES})
target_include_directories(${PROJECT_NAME} PUBLIC ${PROJECT_SOURCE_DIR}/src)
target_link_libraries(${PROJECT_NAME} protobuf::libprotobuf gRPC::grpc gRPC::grpc++)