2020-04-29 04:07:03 +08:00
|
|
|
# We can either use the system-installed PCRE or our bundled version.
|
|
|
|
# This is controlled by the cache variable FISH_USE_SYSTEM_PCRE2.
|
|
|
|
# Here we compute the default value for that variable.
|
2024-01-13 14:17:50 +08:00
|
|
|
# The actual decision is made by the Rust pcre2-sys crate, which searches for the
|
|
|
|
# pkg-config file and uses a vendored copy if it is not available.
|
2020-04-29 04:07:03 +08:00
|
|
|
if ((APPLE) AND (MAC_CODESIGN_ID))
|
|
|
|
# On Mac, a codesigned fish will refuse to load a non-codesigned PCRE2
|
|
|
|
# (e.g. from Homebrew) so default to bundled PCRE2.
|
|
|
|
set(USE_SYS_PCRE2_DEFAULT OFF)
|
|
|
|
else()
|
2024-01-13 14:17:50 +08:00
|
|
|
# Default to using the system PCRE2, if it can be found by the crate
|
2020-04-29 04:07:03 +08:00
|
|
|
set(USE_SYS_PCRE2_DEFAULT ON)
|
2020-03-15 07:11:35 +08:00
|
|
|
endif()
|
2020-04-29 04:07:03 +08:00
|
|
|
|
|
|
|
set(FISH_USE_SYSTEM_PCRE2 ${USE_SYS_PCRE2_DEFAULT} CACHE BOOL
|
2024-01-13 14:17:50 +08:00
|
|
|
"Try to use PCRE2 from the system, instead of the pcre2-sys version")
|
2020-04-29 04:07:03 +08:00
|
|
|
|
|
|
|
if(FISH_USE_SYSTEM_PCRE2)
|
2024-01-13 14:17:50 +08:00
|
|
|
message(STATUS "Trying to use PCRE2 from the system")
|
|
|
|
set(FISH_PCRE2_BUILDFLAG "")
|
2020-03-15 07:11:35 +08:00
|
|
|
else()
|
2024-01-13 14:17:50 +08:00
|
|
|
message(STATUS "Forcing static build of PCRE2")
|
|
|
|
set(FISH_PCRE2_BUILDFLAG "CARGO_FEATURE_STATIC_PCRE2=1")
|
2020-04-29 04:07:03 +08:00
|
|
|
endif(FISH_USE_SYSTEM_PCRE2)
|