Started work on integrating vcpkg, doesn't quite work yet

This commit is contained in:
2026-02-13 21:39:27 +01:00
parent 5edf51e25c
commit 9967d184e0
4 changed files with 53 additions and 4 deletions

View File

@@ -5,8 +5,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)
# Add vcpkg paths to the search
find_program(PROTOC_EXECUTABLE protoc
PATHS
${CMAKE_SOURCE_DIR}/vcpkg_installed/x64-linux/tools/protobuf
${VCPKG_INSTALLED_DIR}/${VCPKG_TARGET_TRIPLET}/tools/protobuf
REQUIRED
NO_DEFAULT_PATH
)
find_program(GRPC_CPP_PLUGIN_EXECUTABLE grpc_cpp_plugin
PATHS
${CMAKE_SOURCE_DIR}/vcpkg_installed/x64-linux/tools/grpc
${VCPKG_INSTALLED_DIR}/${VCPKG_TARGET_TRIPLET}/tools/grpc
REQUIRED
NO_DEFAULT_PATH
)
if(NOT PROTOC_EXECUTABLE)
message(FATAL_ERROR "protoc not found! Install protobuf compiler")
@@ -16,6 +31,9 @@ if(NOT GRPC_CPP_PLUGIN_EXECUTABLE)
message(FATAL_ERROR "grpc_cpp_plugin not found! Install gRPC with C++ plugin")
endif()
message(STATUS "Found protoc: ${PROTOC_EXECUTABLE}")
message(STATUS "Found grpc_cpp_plugin: ${GRPC_CPP_PLUGIN_EXECUTABLE}")
set(PROTO_FILES
${CMAKE_CURRENT_SOURCE_DIR}/messages.proto
${CMAKE_CURRENT_SOURCE_DIR}/services.proto
@@ -59,6 +77,5 @@ target_include_directories(proto_static PUBLIC
target_link_libraries(proto_static PRIVATE
protobuf::libprotobuf
gRPC::grpc
gRPC::grpc++
)