Skip to content

Commit

Permalink
cmake: Add rpath to re2
Browse files Browse the repository at this point in the history
  • Loading branch information
Mizux committed Oct 10, 2024
1 parent fb359ba commit eccff54
Show file tree
Hide file tree
Showing 2 changed files with 19 additions and 1 deletion.
2 changes: 1 addition & 1 deletion cmake/dependencies/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -129,7 +129,7 @@ if(BUILD_re2)
GIT_REPOSITORY "https://github.com/google/re2.git"
GIT_TAG "2024-04-01"
GIT_SHALLOW TRUE
#PATCH_COMMAND git apply --ignore-whitespace "${CMAKE_CURRENT_LIST_DIR}/../../patches/re2-2024-04-01.patch"
PATCH_COMMAND git apply --ignore-whitespace "${CMAKE_CURRENT_LIST_DIR}/../../patches/re2-2024-04-01.patch"
)
FetchContent_MakeAvailable(re2)
list(POP_BACK CMAKE_MESSAGE_INDENT)
Expand Down
18 changes: 18 additions & 0 deletions patches/re2-2024-04-01.patch
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
diff --git a/CMakeLists.txt b/CMakeLists.txt
index bdac5af..cedaf6e 100644
--- a/CMakeLists.txt
+++ b/CMakeLists.txt
@@ -131,6 +131,13 @@ set(RE2_HEADERS

add_library(re2 ${RE2_SOURCES})
target_compile_features(re2 PUBLIC cxx_std_14)
+if(APPLE)
+ set_target_properties(re2 PROPERTIES
+ INSTALL_RPATH "@loader_path")
+elseif(UNIX)
+ set_target_properties(re2 PROPERTIES
+ INSTALL_RPATH "$ORIGIN")
+endif()
target_include_directories(re2 PUBLIC $<BUILD_INTERFACE:${CMAKE_CURRENT_SOURCE_DIR}>)
# CMake gives "set_target_properties called with incorrect number of arguments."
# errors if we don't quote ${RE2_HEADERS}, so quote it despite prevailing style.

0 comments on commit eccff54

Please sign in to comment.