Skip to content

Commit 7c5a7bd

Browse files
authored
Make Findre2.cmake idempotent. (grpc#25821)
As per grpc#25434, idempotence is necessary because CMake fails when another target with the same name already exists. Fixes grpc#25434.
1 parent 57859e3 commit 7c5a7bd

File tree

1 file changed

+7
-0
lines changed

1 file changed

+7
-0
lines changed

cmake/modules/Findre2.cmake

+7
Original file line numberDiff line numberDiff line change
@@ -18,6 +18,13 @@ if(re2_FOUND)
1818
return()
1919
endif()
2020

21+
# As per https://github.com/grpc/grpc/issues/25434, idempotence is necessary
22+
# because CMake fails when another target with the same name already exists.
23+
if(TARGET re2::re2)
24+
message(STATUS "Found RE2 via pkg-config already?")
25+
return()
26+
endif()
27+
2128
find_package(PkgConfig REQUIRED)
2229
# TODO(junyer): Use the IMPORTED_TARGET option whenever CMake 3.6 (or newer)
2330
# becomes the minimum required: that will take care of the add_library() and

0 commit comments

Comments
 (0)