Skip to content

Commit 9be7b9e

Browse files
committed
install targets and my_protocol.pb files generation
1 parent fdb17ed commit 9be7b9e

File tree

3 files changed

+18
-1220
lines changed

3 files changed

+18
-1220
lines changed

CMakeLists.txt

Lines changed: 18 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -9,9 +9,27 @@ include_directories(${ROOT}/threadpool
99
file(GLOB srcs src/*.cpp)
1010
add_library(prototls ${srcs})
1111
target_link_libraries(prototls gnutls protobuf pthread boost_thread)
12+
install(TARGETS prototls DESTINATION
13+
${CMAKE_INSTALL_PREFIX}/lib)
1214

15+
install(FILES ${ROOT}/include/prototls.hpp
16+
DESTINATION ${CMAKE_INSTALL_PREFIX}/include)
17+
file(GLOB headers include/prototls/*.hpp)
18+
foreach(header ${headers})
19+
install(FILES ${header}
20+
DESTINATION ${CMAKE_INSTALL_PREFIX}/include/prototls)
21+
endforeach(header)
22+
23+
24+
add_custom_command(OUTPUT ${ROOT}/example/my_protocol.pb.cc
25+
${ROOT}/example/my_protocol.pb.h
26+
COMMAND
27+
protoc ${ROOT}/example/my_protocol.proto
28+
--proto_path=${ROOT}/example
29+
--cpp_out=${ROOT}/example)
1330
add_library(my_protocol example/my_protocol.pb.cc)
1431
add_executable(testserver example/server.cpp)
1532
add_executable(testclient example/client.cpp)
1633
target_link_libraries(testserver my_protocol prototls)
1734
target_link_libraries(testclient my_protocol prototls)
35+

0 commit comments

Comments
 (0)