diff --git a/client/CMakeLists.txt b/client/CMakeLists.txt index a7504e1..61de839 100644 --- a/client/CMakeLists.txt +++ b/client/CMakeLists.txt @@ -24,7 +24,7 @@ target_include_directories(chat_client target_link_libraries(chat_client PRIVATE - proto_interface + proto_static Qt::Core Qt::Widgets ) diff --git a/proto/CMakeLists.txt b/proto/CMakeLists.txt index c86a7f1..c64c55b 100644 --- a/proto/CMakeLists.txt +++ b/proto/CMakeLists.txt @@ -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++ +) diff --git a/server/CMakeLists.txt b/server/CMakeLists.txt index 526ccfa..da2f237 100644 --- a/server/CMakeLists.txt +++ b/server/CMakeLists.txt @@ -1,9 +1,6 @@ cmake_minimum_required(VERSION 3.23) project(chat_server LANGUAGES CXX) -find_package(protobuf CONFIG REQUIRED) -find_package(gRPC CONFIG REQUIRED) - file(GLOB_RECURSE SOURCES "src/*.ui" "src/*.cpp" "inc/*.h" "res/*.qrc") add_executable(chat_server @@ -13,7 +10,5 @@ add_executable(chat_server target_link_libraries(chat_server PRIVATE - protobuf::libprotobuf - gRPC::grpc - gRPC::grpc++ + proto_static )