This repository has been archived by the owner on Sep 5, 2023. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 4
/
CMakeLists.txt
73 lines (51 loc) · 1.81 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
60
61
62
63
64
65
66
67
68
69
70
71
cmake_minimum_required(VERSION 2.8.9)
set(Boost_USE_STATIC_LIBS OFF)
set(Boost_USE_MULTITHREADED ON)
set(Boost_USE_STATIC_RUNTIME OFF)
project(vss-core)
include_directories(src)
include_directories(include)
INCLUDE_DIRECTORIES(${PROTOBUF_INCLUDE_DIR})
find_package(PkgConfig)
FIND_PACKAGE(Boost 1.40 COMPONENTS program_options REQUIRED)
INCLUDE(FindProtobuf)
FIND_PACKAGE(Protobuf REQUIRED)
find_path(ZeroMQ_INCLUDE_DIR
NAMES zmq.hpp
PATHS ${PC_ZeroMQ_INCLUDE_DIRS}
)
find_library(ZeroMQ_LIBRARY
NAMES zmq
PATHS ${PC_ZeroMQ_LIBRARY_DIRS}
)
include_directories(${Boost_INCLUDE_DIRS})
file(GLOB_RECURSE CPP "src/*.cpp")
file(GLOB_RECURSE CC "src/*.cc")
file(GLOB_RECURSE H "include/*.h")
set(CLION SOURCE ${CC} ${CPP} ${H})
add_library(vss-core SHARED ${CPP} ${CC} ${H})
target_link_libraries(vss-core ${Boost_PROGRAM_OPTIONS_LIBRARY})
target_include_directories(vss-core PUBLIC ${ZeroMQ_INCLUDE_DIR})
target_link_libraries(vss-core PUBLIC ${ZeroMQ_LIBRARY})
target_link_libraries(vss-core ${PROTOBUF_LIBRARIES})
IF(RELEASE)
set(CMAKE_BUILD_TYPE Release)
SET(CMAKE_CXX_FLAGS "-Wall -Werror -o2 -std=c++11")
install(TARGETS vss-core DESTINATION /usr/lib)
install(DIRECTORY include/ DESTINATION include/ FILES_MATCHING PATTERN "*.h")
ELSE()
INCLUDE_DIRECTORIES(third-party)
enable_testing()
add_subdirectory(third-party/googletest)
include_directories(${gtest_SOURCE_DIR}/include ${gtest_SOURCE_DIR})
include_directories(${gmock_SOURCE_DIR}/include ${gmock_SOURCE_DIR})
file(GLOB_RECURSE TEST test/*.cpp)
ADD_EXECUTABLE(tests ${TEST})
target_link_libraries(tests
pthread
gtest
gtest_main
vss-core
${PROTOBUF_LIBRARIES})
SET(CMAKE_CXX_FLAGS "-g -Wall -Werror -std=c++11")
ENDIF()