Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Revert find_package logic #295

Merged
merged 2 commits into from
Sep 24, 2024
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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
Loading