Generate from proto and include as static library in client and server
This commit is contained in:
@@ -1,6 +1,10 @@
|
||||
cmake_minimum_required(VERSION 3.23)
|
||||
project(proto LANGUAGES CXX)
|
||||
|
||||
|
||||
find_package(protobuf CONFIG REQUIRED)
|
||||
find_package(gRPC CONFIG REQUIRED)
|
||||
|
||||
find_program(PROTOC_EXECUTABLE protoc)
|
||||
find_program(GRPC_CPP_PLUGIN_EXECUTABLE grpc_cpp_plugin)
|
||||
|
||||
@@ -47,4 +51,14 @@ add_custom_command(
|
||||
|
||||
set_source_files_properties(${GENERATED_FILES} PROPERTIES GENERATED TRUE)
|
||||
|
||||
add_library(proto_interface INTERFACE ${GENERATED_FILES})
|
||||
add_library(proto_static STATIC ${GENERATED_FILES})
|
||||
|
||||
target_include_directories(proto_static PUBLIC
|
||||
${PROTO_OUT}
|
||||
)
|
||||
|
||||
target_link_libraries(proto_static PRIVATE
|
||||
protobuf::libprotobuf
|
||||
gRPC::grpc
|
||||
gRPC::grpc++
|
||||
)
|
||||
|
||||
Reference in New Issue
Block a user