Skip to content

Commit 997522b

Browse files
author
zhujiashun
committed
remove unnecessary find protobuf
1 parent c90162a commit 997522b

File tree

24 files changed

+23
-87
lines changed

24 files changed

+23
-87
lines changed

.travis.yml

Lines changed: 1 addition & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -11,16 +11,8 @@ env:
1111
- PURPOSE=unittest
1212

1313
install:
14-
- sudo apt-get install -qq realpath libgflags-dev libprotobuf-dev libprotoc-dev protobuf-compiler libleveldb-dev libgoogle-perftools-dev libpthread-stubs0-dev libboost-all-dev
14+
- sudo apt-get install -qq realpath libgflags-dev libprotobuf-dev libprotoc-dev protobuf-compiler libleveldb-dev libgoogle-perftools-dev
1515
- sudo apt-get install libgtest-dev && cd /usr/src/gtest && sudo env "PATH=$PATH" cmake . && sudo make && sudo mv libgtest* /usr/lib/ && cd -
1616

1717
script:
1818
- sh build_in_travis_ci.sh
19-
20-
addons:
21-
apt:
22-
sources:
23-
- george-edison55-precise-backports
24-
packages:
25-
- cmake-data
26-
- cmake

CMakeLists.txt

Lines changed: 15 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -1,13 +1,23 @@
1-
cmake_minimum_required(VERSION 3.1)
1+
cmake_minimum_required(VERSION 2.8.10)
22
project(brpc C CXX)
33

4-
if(CMAKE_CXX_COMPILER_VERSION VERSION_LESS 4.8)
5-
#message(FATAL_ERROR "GCC is too old, please install a newer version supporting C++11")
4+
if(CMAKE_CXX_COMPILER_ID STREQUAL "GNU")
5+
# require at least gcc 4.8
6+
if(CMAKE_CXX_COMPILER_VERSION VERSION_LESS 4.8)
7+
message(FATAL_ERROR "GCC is too old, please install a newer version supporting C++11")
8+
endif()
9+
elseif(CMAKE_CXX_COMPILER_ID STREQUAL "Clang")
10+
# require at least clang 3.3
11+
if(CMAKE_CXX_COMPILER_VERSION VERSION_LESS 3.3)
12+
message(FATAL_ERROR "Clang is too old, please install a newer version supporting C++11")
13+
endif()
14+
else()
15+
message(WARNING "You are using an unsupported compiler! Compilation has only been tested with Clang and GCC.")
616
endif()
717

818
option(WITH_GLOG "With glog" OFF)
919
option(BRPC_DEBUG "With debug symbol" ON)
10-
option(BUILD_EXAMPLE "Whether building examples" OFF)
20+
option(BUILD_EXAMPLE "Whether building examples" ON)
1121
option(BUILD_UNIT_TESTS "Whether building unit tests" OFF)
1222

1323
if(WITH_GLOG)
@@ -30,8 +40,7 @@ execute_process(
3040
COMMAND bash -c "grep \"namespace [_A-Za-z0-9]\\+ {\" ${GFLAGS_INCLUDE_PATH}/gflags/gflags_declare.h | head -1 | awk '{print $2}' | tr -d '\n'"
3141
OUTPUT_VARIABLE GFLAGS_NS
3242
)
33-
# STREQUAL not works. Use MATCHES as workaround
34-
if(${GFLAGS_NS} MATCHES ".*GFLAGS_NAMESPACE.*")
43+
if(${GFLAGS_NS} STREQUAL "GFLAGS_NAMESPACE")
3544
execute_process(
3645
COMMAND bash -c "grep \"#define GFLAGS_NAMESPACE [_A-Za-z0-9]\\+\" ${GFLAGS_INCLUDE_PATH}/gflags/gflags_declare.h | head -1 | awk '{print $3}' | tr -d '\n'"
3746
OUTPUT_VARIABLE GFLAGS_NS
@@ -63,15 +72,6 @@ if(NOT (CMAKE_CXX_COMPILER_VERSION VERSION_LESS 7.0))
6372
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -Wno-aligned-new")
6473
endif()
6574

66-
#find_package(Threads REQUIRED)
67-
68-
#find_path(GFLAGS_HEADER NAMES gflags/gflags.h)
69-
#find_library(GFLAGS_LIB NAMES gflags)
70-
#find_package(gflags REQUIRED)
71-
72-
#find_path(THREADS_HEADER NAMES pthread.h)
73-
#find_library(THREADS_LIB NAMES pthread)
74-
7575
find_path(PROTOBUF_HEADER NAMES google/protobuf/stubs/common.h)
7676
find_library(PROTOBUF_LIB NAMES protobuf)
7777

@@ -91,7 +91,6 @@ include_directories(
9191
${PROTOBUF_HEADER}
9292
${LEVELDB_HEADER}
9393
${THREAD_HEADER}
94-
#${THREADS_HEADER}
9594
)
9695

9796
# for *.so

example/CMakeLists.txt

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,7 @@
1+
include(FindProtobuf)
2+
find_package(Protobuf REQUIRED)
3+
include_directories(${PROTOBUF_INCLUDE_DIR})
4+
15
add_subdirectory(http_c++)
26
add_subdirectory(asynchronous_echo_c++)
37
add_subdirectory(backup_request_c++)

example/asynchronous_echo_c++/CMakeLists.txt

Lines changed: 0 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,3 @@
1-
include(FindProtobuf)
2-
find_package(Protobuf REQUIRED)
3-
include_directories(${PROTOBUF_INCLUDE_DIR})
41
protobuf_generate_cpp(PROTO_SRC PROTO_HEADER echo.proto)
52
get_filename_component(HEADER_DIR ${PROTO_HEADER} DIRECTORY)
63
include_directories(${HEADER_DIR})

example/backup_request_c++/CMakeLists.txt

Lines changed: 0 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,3 @@
1-
include(FindProtobuf)
2-
find_package(Protobuf REQUIRED)
3-
include_directories(${PROTOBUF_INCLUDE_DIR})
41
protobuf_generate_cpp(PROTO_SRC PROTO_HEADER echo.proto)
52
get_filename_component(HEADER_DIR ${PROTO_HEADER} DIRECTORY)
63
include_directories(${HEADER_DIR})

example/cancel_c++/CMakeLists.txt

Lines changed: 0 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,3 @@
1-
include(FindProtobuf)
2-
find_package(Protobuf REQUIRED)
3-
include_directories(${PROTOBUF_INCLUDE_DIR})
41
protobuf_generate_cpp(PROTO_SRC PROTO_HEADER echo.proto)
52
get_filename_component(HEADER_DIR ${PROTO_HEADER} DIRECTORY)
63
include_directories(${HEADER_DIR})

example/cascade_echo_c++/CMakeLists.txt

Lines changed: 0 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,3 @@
1-
include(FindProtobuf)
2-
find_package(Protobuf REQUIRED)
3-
include_directories(${PROTOBUF_INCLUDE_DIR})
41
protobuf_generate_cpp(PROTO_SRC PROTO_HEADER echo.proto)
52
get_filename_component(HEADER_DIR ${PROTO_HEADER} DIRECTORY)
63
include_directories(${HEADER_DIR})

example/dynamic_partition_echo_c++/CMakeLists.txt

Lines changed: 0 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,3 @@
1-
include(FindProtobuf)
2-
find_package(Protobuf REQUIRED)
3-
include_directories(${PROTOBUF_INCLUDE_DIR})
41
protobuf_generate_cpp(PROTO_SRC PROTO_HEADER echo.proto)
52
get_filename_component(HEADER_DIR ${PROTO_HEADER} DIRECTORY)
63
include_directories(${HEADER_DIR})

example/echo_c++/CMakeLists.txt

Lines changed: 0 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,3 @@
1-
include(FindProtobuf)
2-
find_package(Protobuf REQUIRED)
3-
include_directories(${PROTOBUF_INCLUDE_DIR})
41
protobuf_generate_cpp(PROTO_SRC PROTO_HEADER echo.proto)
52
get_filename_component(HEADER_DIR ${PROTO_HEADER} DIRECTORY)
63
include_directories(${HEADER_DIR})

example/echo_c++_hulu_pbrpc/CMakeLists.txt

Lines changed: 0 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,3 @@
1-
include(FindProtobuf)
2-
find_package(Protobuf REQUIRED)
3-
include_directories(${PROTOBUF_INCLUDE_DIR})
41
protobuf_generate_cpp(PROTO_SRC PROTO_HEADER echo.proto)
52
get_filename_component(HEADER_DIR ${PROTO_HEADER} DIRECTORY)
63
include_directories(${HEADER_DIR})

0 commit comments

Comments
 (0)