forked from apache/pulsar
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathCMakeLists.txt
114 lines (99 loc) · 3.18 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
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
#
# Licensed to the Apache Software Foundation (ASF) under one
# or more contributor license agreements. See the NOTICE file
# distributed with this work for additional information
# regarding copyright ownership. The ASF licenses this file
# to you under the Apache License, Version 2.0 (the
# "License"); you may not use this file except in compliance
# with the License. You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing,
# software distributed under the License is distributed on an
# "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
# KIND, either express or implied. See the License for the
# specific language governing permissions and limitations
# under the License.
#
cmake_minimum_required(VERSION 2.8)
project (pulsar-cpp)
set(Boost_NO_BOOST_CMAKE ON)
set (CMAKE_CXX_FLAGS "-O3 -g -Wno-deprecated-declarations ${CMAKE_CXX_FLAGS}")
set(PROTOBUF_LIBRARIES $ENV{PROTOBUF_LIBRARIES})
set(LOG_CATEGORY_NAME $ENV{LOG_CATEGORY_NAME})
if (NOT LOG_CATEGORY_NAME)
set(LOG_CATEGORY_NAME "\"pulsar.\"")
endif(NOT LOG_CATEGORY_NAME)
add_definitions(-DLOG_CATEGORY_NAME=${LOG_CATEGORY_NAME})
find_package(Boost REQUIRED COMPONENTS program_options filesystem regex
thread system python
)
find_package(PythonLibs REQUIRED)
find_package(OpenSSL REQUIRED)
find_package(ZLIB REQUIRED)
if (NOT PROTOBUF_LIBRARIES)
find_package(ProtoBuf QUIET)
if (NOT ProtoBuf_FOUND)
find_library(PROTOBUF_LIBRARIES protobuf)
endif (NOT ProtoBuf_FOUND)
endif (NOT PROTOBUF_LIBRARIES)
find_library(LOG4CXX_LIBRARY_PATH log4cxx)
find_library(CURL_LIBRARY_PATH curl)
find_path(LOG4CXX_INCLUDE_PATH log4cxx/logger.h)
find_path(GTEST_INCLUDE_PATH gtest/gtest.h)
find_path(JSON_INCLUDE_PATH jsoncpp)
find_library(LIB_JSON jsoncpp)
if (NOT LIB_JSON)
find_library(LIB_JSON json_cpp)
endif (NOT LIB_JSON)
if (NOT JSON_INCLUDE_PATH)
find_path(JSON_INCLUDE_PATH json)
else (NOT JSON_INCLUDE_PATH)
set(JSON_INCLUDE_PATH ${JSON_INCLUDE_PATH}/jsoncpp/)
endif (NOT JSON_INCLUDE_PATH)
set(ADDITIONAL_LIBRARIES $ENV{PULSAR_ADDITIONAL_LIBRARIES})
link_directories( $ENV{PULSAR_ADDITIONAL_LIBRARY_PATH} )
include_directories(
${CMAKE_SOURCE_DIR}
${CMAKE_SOURCE_DIR}/include
${Boost_INCLUDE_DIR}
${OPENSSL_INCLUDE_DIR}
${ZLIB_INCLUDE_DIR}
${PROTOBUF_INCLUDE_DIR}
${LOG4CXX_INCLUDE_PATH}
${GTEST_INCLUDE_PATH}
${JSON_INCLUDE_PATH}
)
set(COMMON_LIBS
${COMMON_LIBS} -lpthread -lm
${Boost_PROGRAM_OPTIONS_LIBRARY}
${Boost_FILESYSTEM_LIBRARY}
${Boost_REGEX_LIBRARY}
${Boost_THREAD_LIBRARY}
${Boost_SYSTEM_LIBRARY}
${Boost_CHRONO_LIBRARY}
${Boost_DATE_TIME_LIBRARY}
${Boost_ATOMIC_LIBRARY}
${OPENSSL_LIBRARIES}
${ZLIB_LIBRARIES}
${PROTOBUF_LIBRARIES}
${LOG4CXX_LIBRARY_PATH}
${CURL_LIBRARY_PATH}
${ADDITIONAL_LIBRARIES}
${LIB_JSON}
)
link_directories(${CMAKE_BINARY_DIR}/lib)
set(LIB_NAME $ENV{PULSAR_LIBRARY_NAME})
if (NOT LIB_NAME)
set(LIB_NAME pulsar)
endif(NOT LIB_NAME)
set(CLIENT_LIBS
${COMMON_LIBS}
${LIB_NAME}
)
add_subdirectory(lib)
add_subdirectory(perf)
add_subdirectory(examples)
add_subdirectory(tests)
add_subdirectory(python)