Skip to content

Commit 1be4ff4

Browse files
genevievehelselmeta-codesync[bot]
authored andcommitted
FindRe2: use re2's package config, whose re2::re2 links abseil
Summary: `FindRe2.cmake` finds re2 with `find_library()`, which gets only re2 itself. A static re2, such as the one vcpkg builds for eden's Windows build, also needs the abseil libraries it was built against, so linking `edenfs.exe` fails with 48 unresolved `absl::` symbols from `re2.lib`. re2's package config defines `re2::re2` with them, so `FindRe2` now uses that target when re2 has a config, as HHVM's and Velox's builds already do, and still falls back to `find_library()` when it doesn't. ___ landed-with-radar-review Differential Revision: D128886633 fbshipit-source-id: 1337eb976bc27879fb1badd2bb770a65d5cc47a4
1 parent 57660d9 commit 1be4ff4

1 file changed

Lines changed: 8 additions & 1 deletion

File tree

‎build/fbcode_builder/CMake/FindRe2.cmake‎

Lines changed: 8 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,14 @@
33
# This software may be used and distributed according to the terms of the
44
# GNU General Public License version 2.
55

6-
find_library(RE2_LIBRARY re2)
6+
# re2's package config, where re2 has one, defines re2::re2 with the abseil
7+
# libraries that a static re2 needs and a bare find_library() leaves out.
8+
find_package(re2 CONFIG QUIET)
9+
if(TARGET re2::re2)
10+
set(RE2_LIBRARY re2::re2)
11+
else()
12+
find_library(RE2_LIBRARY re2)
13+
endif()
714
mark_as_advanced(RE2_LIBRARY)
815

916
find_path(RE2_INCLUDE_DIR NAMES re2/re2.h)

0 commit comments

Comments
 (0)