Skip to content

Commit

Permalink
Revert find_package logic (#295)
Browse files Browse the repository at this point in the history
  • Loading branch information
lia-viam authored Sep 24, 2024
1 parent c428bb5 commit 32b31fa
Showing 1 changed file with 2 additions and 4 deletions.
6 changes: 2 additions & 4 deletions CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -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})

Expand All @@ -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)
Expand Down Expand Up @@ -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
Expand Down

0 comments on commit 32b31fa

Please sign in to comment.