Skip to content

Commit 34d721d

Browse files
committed
review fixes
1 parent cfeb211 commit 34d721d

2 files changed

Lines changed: 6 additions & 18 deletions

File tree

cmake/SetupProtobuf.cmake

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -41,7 +41,7 @@ if(NOT USERVER_FORCE_DOWNLOAD_PROTOBUF)
4141
if(USERVER_DOWNLOAD_PACKAGE_PROTOBUF)
4242
find_package(Protobuf QUIET)
4343
else()
44-
find_package(Protobuf CONFIG)
44+
find_package(Protobuf CONFIG QUIET)
4545
if (NOT Protobuf_FOUND)
4646
find_package(Protobuf)
4747
endif()
@@ -60,7 +60,7 @@ if(NOT USERVER_FORCE_DOWNLOAD_PROTOBUF)
6060

6161
if(Protobuf_FOUND)
6262
_userver_set_protobuf_version_category()
63-
set(PROTOBUF_PROTOC "${Protobuf_PROTOC_EXECUTABLE}")
63+
set(PROTOBUF_PROTOC $<TARGET_FILE:protobuf::protoc>)
6464
return()
6565
endif()
6666
endif()
@@ -92,4 +92,3 @@ set_target_properties(libprotoc PROPERTIES INTERFACE_INCLUDE_DIRECTORIES "${Prot
9292
write_package_stub(Protobuf)
9393
mark_targets_as_system("${Protobuf_SOURCE_DIR}")
9494
_userver_set_protobuf_version_category()
95-
set(PROTOBUF_PROTOC $<TARGET_FILE:protoc>)

cmake/UserverGrpcTargets.cmake

Lines changed: 4 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -43,22 +43,11 @@ function(_userver_prepare_grpc)
4343
PARENT_SCOPE
4444
)
4545

46-
if(Protobuf_INCLUDE_DIR)
46+
get_target_property(Protobuf_INCLUDE_DIR protobuf::libprotobuf INTERFACE_INCLUDE_DIRECTORIES)
47+
if (Protobuf_INCLUDE_DIR)
4748
set_property(GLOBAL PROPERTY userver_protobuf_import_dir "${Protobuf_INCLUDE_DIR}")
48-
elseif(protobuf_INCLUDE_DIR)
49-
set_property(GLOBAL PROPERTY userver_protobuf_import_dir "${protobuf_INCLUDE_DIR}")
50-
elseif(Protobuf_INCLUDE_DIRS)
51-
set_property(GLOBAL PROPERTY userver_protobuf_import_dir "${Protobuf_INCLUDE_DIRS}")
52-
elseif(protobuf_INCLUDE_DIRS)
53-
set_property(GLOBAL PROPERTY userver_protobuf_import_dir "${protobuf_INCLUDE_DIRS}")
5449
else()
55-
# maybe we found protobuf config
56-
get_target_property(_incs protobuf::libprotobuf INTERFACE_INCLUDE_DIRECTORIES)
57-
if (_incs)
58-
set_property(GLOBAL PROPERTY userver_protobuf_import_dir "${_incs}")
59-
else()
60-
message(FATAL_ERROR "Invalid Protobuf package")
61-
endif()
50+
message(FATAL_ERROR "Invalid Protobuf package")
6251
endif()
6352

6453
if(NOT Protobuf_VERSION)
@@ -67,7 +56,7 @@ function(_userver_prepare_grpc)
6756
if(NOT gRPC_VERSION)
6857
message(FATAL_ERROR "Invalid gRPC package")
6958
endif()
70-
if(NOT PROTOBUF_PROTOC AND NOT TARGET protobuf::libprotoc)
59+
if(NOT PROTOBUF_PROTOC)
7160
message(FATAL_ERROR "protoc not found")
7261
endif()
7362
if(NOT PROTO_GRPC_CPP_PLUGIN)

0 commit comments

Comments
 (0)