Skip to content

Commit

Permalink
Make Findre2.cmake idempotent. (grpc#25821)
Browse files Browse the repository at this point in the history
As per grpc#25434, idempotence is necessary
because CMake fails when another target with the same name already exists.

Fixes grpc#25434.
  • Loading branch information
junyer authored Apr 8, 2021
1 parent 57859e3 commit 7c5a7bd
Showing 1 changed file with 7 additions and 0 deletions.
7 changes: 7 additions & 0 deletions cmake/modules/Findre2.cmake
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,13 @@ if(re2_FOUND)
return()
endif()

# As per https://github.com/grpc/grpc/issues/25434, idempotence is necessary
# because CMake fails when another target with the same name already exists.
if(TARGET re2::re2)
message(STATUS "Found RE2 via pkg-config already?")
return()
endif()

find_package(PkgConfig REQUIRED)
# TODO(junyer): Use the IMPORTED_TARGET option whenever CMake 3.6 (or newer)
# becomes the minimum required: that will take care of the add_library() and
Expand Down

0 comments on commit 7c5a7bd

Please sign in to comment.