Skip to content
This repository was archived by the owner on Dec 22, 2021. It is now read-only.

Commit 7f63ce1

Browse files
authored
fix: avoid warnings with newer CMake versions (#48)
I noticed this with CMake 3.17.1, but may have started earlier. Using `include()` to load a module does not work because the calls to `find_package_handle_standard_args()` generate a ton of warnings. Loading the module using `find_package()` works as expected.
1 parent 3649515 commit 7f63ce1

File tree

2 files changed

+5
-3
lines changed

2 files changed

+5
-3
lines changed

cmake/FindgRPC.cmake

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -68,7 +68,8 @@ find_package(Threads REQUIRED)
6868
# Load the module to find protobuf with proper targets. Do not use
6969
# `find_package()` because we (have to) install this module in non-standard
7070
# locations.
71-
include(${CMAKE_CURRENT_LIST_DIR}/FindProtobufTargets.cmake)
71+
list(APPEND CMAKE_MODULE_PATH "${CMAKE_CURRENT_LIST_DIR}")
72+
find_package(ProtobufTargets)
7273

7374
# The gRPC::grpc_cpp_plugin target is sometimes defined, but without a
7475
# IMPORTED_LOCATION

cmake/config.cmake.in

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -14,8 +14,9 @@
1414
# limitations under the License.
1515
# ~~~
1616

17-
include("${CMAKE_CURRENT_LIST_DIR}/FindProtobufTargets.cmake")
18-
include("${CMAKE_CURRENT_LIST_DIR}/FindgRPC.cmake")
17+
list(APPEND CMAKE_MODULE_PATH "${CMAKE_CURRENT_LIST_DIR}")
18+
find_package(ProtobufTargets)
19+
find_package(gRPC)
1920

2021
include("${CMAKE_CURRENT_LIST_DIR}/googleapis-targets.cmake")
2122

0 commit comments

Comments
 (0)