-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathCMakeLists.txt
59 lines (49 loc) · 1.8 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
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
cmake_minimum_required(VERSION 3.25)
include (CheckIncludeFiles)
project (transport)
set(CMAKE_CXX_STANDARD 17)
add_subdirectory(tools)
check_include_files(ifaddrs.h HAVE_IFADDRS_H)
configure_file(${CMAKE_CURRENT_SOURCE_DIR}/cmake/config.h.in src/config.h)
########################################
# The Google Protobuf library for message generation + serialization
find_package(Protobuf REQUIRED)
if (NOT PROTOBUF_FOUND)
BUILD_ERROR ("Missing: Google Protobuf")
endif()
if (NOT PROTOBUF_PROTOC_EXECUTABLE)
BUILD_ERROR ("Missing: Google Protobuf Compiler")
endif()
if (NOT PROTOBUF_PROTOC_LIBRARY)
BUILD_ERROR ("Missing: Google Protobuf Compiler Library")
endif()
find_package(cppzmq CONFIG REQUIRED)
# Create the transport library
add_library(transport
src/transport.cpp
src/socket.cpp
src/netUtils.cpp
src/packet.cpp
src/topicsInfo.cpp
src/uuid.cpp
)
target_include_directories(transport PUBLIC ./include)
target_link_libraries(transport PUBLIC
protobuf::libprotobuf
cppzmq
)
target_compile_definitions(transport
PUBLIC
-D_CRT_SECURE_NO_WARNINGS # remove secure warnings (e.g sprinft_s)
-DNOMINMAX # remove min/max macros
-D_WINSOCK_DEPRECATED_NO_WARNINGS # remove winsock deprecated warnings
)
target_link_libraries(transport PUBLIC wsock32 )
# Unit tests
find_package(Catch2 3 REQUIRED)
add_executable(UNIT_packet_TEST test/packet_TEST.cpp)
add_executable(UNIT_topicsInfo_TEST test/topicsInfo_TEST.cpp)
add_executable(UNIT_transport_TEST test/transport_TEST.cpp)
target_link_libraries(UNIT_packet_TEST transport Catch2::Catch2WithMain)
target_link_libraries(UNIT_topicsInfo_TEST transport Catch2::Catch2WithMain)
target_link_libraries(UNIT_transport_TEST transport Catch2::Catch2WithMain)