From 6537fbee099d6b4c25ae20cfd1876f2cfef01b6f Mon Sep 17 00:00:00 2001 From: Lia Stratopoulos <167905060+lia-viam@users.noreply.github.com> Date: Tue, 24 Sep 2024 13:24:49 -0400 Subject: [PATCH] revert find_package logic --- CMakeLists.txt | 6 ++---- 1 file changed, 2 insertions(+), 4 deletions(-) diff --git a/CMakeLists.txt b/CMakeLists.txt index 1c85ef31f..6d5dfc2de 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -358,7 +358,7 @@ find_package(gRPC ${VIAMCPPSDK_GRPC_VERSION_MINIMUM} CONFIG) # no version here and check it manually below. find_package(Protobuf CONFIG) -if (gRPC_FOUND AND Protobuf_FOUND) +if (gRPC_FOUND) get_target_property(VIAMCPPSDK_GRPC_CPP_PLUGIN gRPC::grpc_cpp_plugin LOCATION) set(VIAMCPPSDK_PROTOBUF_VERSION ${Protobuf_VERSION}) @@ -378,7 +378,7 @@ if (gRPC_FOUND AND Protobuf_FOUND) set(VIAMCPPSDK_GRPCXX_VERSION ${gRPC_VERSION}) set(VIAMCPPSDK_GRPCXX_LIBRARIES gRPC::grpc++) set(VIAMCPPSDK_GRPCXX_REFLECTION_LIBRARIES gRPC::grpc++_reflection) -elseif((NOT gRPC_FOUND) AND (NOT Protobuf_FOUND)) +else() message(WARNING "Failed to find gRPC with `find_package`; falling back to `pkg_check_modules`") include(FindPkgConfig) @@ -414,8 +414,6 @@ elseif((NOT gRPC_FOUND) AND (NOT Protobuf_FOUND)) set(VIAMCPPSDK_GRPCXX_REFLECTION_LIBRARIES ${VIAMCPPSDK_GRPCXX_LIBRARIES}) set(VIAMCPPSDK_GRPCXX_REFLECTION_LIB ${VIAMCPPSDK_GRPCXX_ROOT}_reflection) list(PREPEND VIAMCPPSDK_GRPCXX_REFLECTION_LIBRARIES ${VIAMCPPSDK_GRPCXX_REFLECTION_LIB}) -else() - message(FATAL_ERROR "Unexpected combination of find_package and pkg-config protobuf and gRPC") endif() # Do this here unconditionally in case find_package didn't set the MAJOR/MINOR variables