diff --git a/source/CMakeLists.txt b/source/CMakeLists.txt index c6a8d9f4a..04014647e 100644 --- a/source/CMakeLists.txt +++ b/source/CMakeLists.txt @@ -27,7 +27,13 @@ find_package(nlohmann_json REQUIRED) find_package(fmt REQUIRED) find_package(spdlog REQUIRED) find_package(PkgConfig REQUIRED) -pkg_check_modules(gRPC REQUIRED IMPORTED_TARGET protobuf grpc++) +find_package(gRPC) +if (gRPC_FOUND) + set(GRPC_TARGET gRPC::grpc++) +else () + pkg_check_modules(gRPC REQUIRED IMPORTED_TARGET protobuf grpc++) + set(GRPC_TARGET PkgConfig::gRPC) +endif() if (UNIX AND NOT APPLE) set(SUPPORT_PRELOAD 1) diff --git a/source/intercept/proto/CMakeLists.txt b/source/intercept/proto/CMakeLists.txt index e4fb8c157..86a209a57 100644 --- a/source/intercept/proto/CMakeLists.txt +++ b/source/intercept/proto/CMakeLists.txt @@ -62,4 +62,4 @@ target_sources(rpc_a INTERFACE $ ) -target_link_libraries(rpc_a PUBLIC PkgConfig::gRPC) +target_link_libraries(rpc_a PUBLIC ${GRPC_TARGET})