Skip to content

[C++] Make FindRE2.cmake re-entrant #26035

@asfimport

Description

@asfimport

Repeated calls to FindRE2.cmake try to recreate the exisiting target RE2::re2 which is prohibited by CMake and fails with the following error:

CMake Warning (dev) at C:/Miniconda37-x64/envs/arrow/Library/share/cmake-3.17/Modules/FindPackageHandleStandardArgs.cmake:272 (message):
  The package name passed to `find_package_handle_standard_args` (RE2) does
  not match the name of the calling package (re2).  This can lead to problems
  in calling code that expects `find_package` result variables (e.g.,
  `_FOUND`) to follow a certain pattern.
Call Stack (most recent call first):
  cmake_modules/FindRE2.cmake:63 (find_package_handle_standard_args)
  C:/Miniconda37-x64/envs/arrow/Library/lib/cmake/grpc/gRPCConfig.cmake:21 (find_package)
  cmake_modules/ThirdpartyToolchain.cmake:2472 (find_package)
  CMakeLists.txt:495 (include)
This warning is for project developers.  Use -Wno-dev to suppress it.
CMake Error at cmake_modules/FindRE2.cmake:66 (add_library):
  add_library cannot create imported target "RE2::re2" because another target
  with the same name already exists.
Call Stack (most recent call first):
  C:/Miniconda37-x64/envs/arrow/Library/lib/cmake/grpc/gRPCConfig.cmake:21 (find_package)
  cmake_modules/ThirdpartyToolchain.cmake:2472 (find_package)
  CMakeLists.txt:495 (include)

Note that this issue only occurs currently on case-insensitive file systems when ARROW_FLIGHT=ON is set.

Reporter: Uwe Korn / @xhochy
Assignee: Uwe Korn / @xhochy

PRs and other links:

Note: This issue was originally created as ARROW-10011. Please see the migration documentation for further details.

Metadata

Metadata

Assignees

Type

No type
No fields configured for issues without a type.

Projects

No projects

Milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions