Commit 9a08ce55 authored by Jason S Zang's avatar Jason S Zang

Add cmake pkgconfig generation for easier usage from other projects

parent 86827305
cmake_minimum_required(VERSION 2.8.10)
project(brpc C CXX)
set(BRPC_VERSION 0.9.0)
if(CMAKE_CXX_COMPILER_ID STREQUAL "GNU")
# require at least gcc 4.8
if(CMAKE_CXX_COMPILER_VERSION VERSION_LESS 4.8)
......@@ -131,8 +133,10 @@ set(DYNAMIC_LIB
dl
z
)
set(BRPC_PRIVATE_LIBS "-lgflags -lprotobuf -lleveldb -lprotoc -lrt -lssl -lcrypto -ldl -lz")
if(BRPC_WITH_GLOG)
set(DYNAMIC_LIB ${DYNAMIC_LIB} ${GLOG_LIB})
set(BRPC_PRIVATE_LIBS "${BRPC_PRIVATE_LIBS} -lglog")
endif()
# for *.so
......@@ -344,3 +348,7 @@ install(DIRECTORY ${CMAKE_CURRENT_BINARY_DIR}/output/include/
PATTERN "*.h"
PATTERN "*.hpp"
)
# Install pkgconfig
configure_file(cmake/brpc.pc.in ${CMAKE_BINARY_DIR}/brpc.pc @ONLY)
install(FILES ${CMAKE_BINARY_DIR}/brpc.pc DESTINATION ${CMAKE_INSTALL_LIBDIR}/pkgconfig)
prefix=@CMAKE_INSTALL_PREFIX@
exec_prefix=${prefix}
includedir=${prefix}/@CMAKE_INSTALL_INCLUDEDIR@
libdir=${prefix}/@CMAKE_INSTALL_LIBDIR@
Name: brpc
Description: A industrial-grade RPC framework used throughout Baidu, with 1,000,000+ instances(not counting clients) and thousands kinds of services, called "baidu-rpc" inside Baidu.
Version: @BRPC_VERSION@
Cflags: -I${includedir}
Libs: -L${libdir}/ -lbrpc
Libs.private: @BRPC_PRIVATE_LIBS@
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment