1 diff --git a/3rd-party/CMakeLists.txt b/3rd-party/CMakeLists.txt
2 index 73291f6c..c1a38198 100644
3 --- a/3rd-party/CMakeLists.txt
4 +++ b/3rd-party/CMakeLists.txt
5 @@ -4,6 +4,24 @@ if (MSVC)
6 add_compile_options(-wd5045) #Disable warning about Spectre mitigation
10 +set(FETCHCONTENT_QUIET FALSE)
12 +FetchContent_Declare(gRPC
13 + DOWNLOAD_COMMAND true
14 + SOURCE_DIR ${CMAKE_CURRENT_SOURCE_DIR}/grpc
17 +set(gRPC_SSL_PROVIDER "package" CACHE STRING "Provider of ssl library")
19 +FetchContent_MakeAvailable(gRPC)
21 +# Workaround for zlib placing its generated zconf.h file in the build dir,
22 +# and protobuf not knowing so finding the system version instead
23 +include_directories(${grpc_SOURCE_DIR}/third_party/zlib)
25 +set_property(DIRECTORY ${grpc_SOURCE_DIR} PROPERTY EXCLUDE_FROM_ALL YES)
27 # Generates gRPC and protobuf C++ sources and headers from the given .proto files
29 # generate_grpc_cpp (<SRCS> <DEST> [<ARGN>...])
30 @@ -34,9 +52,9 @@ function(generate_grpc_cpp SRCS DEST)
31 "${DEST}/${FIL_WE}.grpc.pb.h"
32 "${DEST}/${FIL_WE}.pb.cc"
33 "${DEST}/${FIL_WE}.pb.h"
34 - COMMAND $<TARGET_FILE:protobuf::protoc>
35 - ARGS --grpc_out=${DEST} --cpp_out=${DEST} --proto_path=${FIL_DIR} --proto_path=${grpc_SOURCE_DIR}/third_party/protobuf/src --plugin=protoc-gen-grpc=$<TARGET_FILE:gRPC::grpc_cpp_plugin> ${ABS_FIL}
37 + COMMAND $<TARGET_FILE:protoc>
38 + ARGS --grpc_out=${DEST} --cpp_out=${DEST} --proto_path=${FIL_DIR} --proto_path=${grpc_SOURCE_DIR}/third_party/protobuf/src --plugin=protoc-gen-grpc=$<TARGET_FILE:grpc_cpp_plugin> ${ABS_FIL}
39 + DEPENDS ${ABS_FIL} protoc grpc_cpp_plugin
40 COMMENT "Running gRPC C++ protocol buffer compiler on ${FIL}"
43 @@ -47,9 +65,14 @@ endfunction()
45 add_library(gRPC INTERFACE)
47 +target_include_directories(gRPC INTERFACE
48 + ${CMAKE_CURRENT_SOURCE_DIR}/grpc/include
49 + ${CMAKE_CURRENT_SOURCE_DIR}/grpc/third_party/protobuf/src)
51 target_link_libraries(gRPC INTERFACE
53 - protobuf::libprotobuf)
59 target_compile_options(gRPC INTERFACE "-Wno-unused-parameter" "-Wno-non-virtual-dtor" "-Wno-pedantic")
60 diff --git a/CMakeLists.txt b/CMakeLists.txt
61 index 18e47b74..d5bf5dea 100644
64 @@ -49,9 +49,6 @@ if(NOT DEFINED VCPKG_BUILD_DEFAULT)
65 set(VCPKG_TARGET_TRIPLET "${VCPKG_HOST_ARCH}-${VCPKG_HOST_OS}-release")
68 -set(CMAKE_TOOLCHAIN_FILE "${CMAKE_CURRENT_SOURCE_DIR}/3rd-party/vcpkg/scripts/buildsystems/vcpkg.cmake"
69 - CACHE STRING "Vcpkg toolchain file")
73 option(MULTIPASS_ENABLE_TESTS "Build tests" ON)
74 @@ -125,9 +122,6 @@ endif()
76 find_package(OpenSSL REQUIRED)
79 -find_package(gRPC CONFIG REQUIRED)
81 # Needs to be here before we set further compilation options
82 add_subdirectory(3rd-party)