Skip to content

cmake: add an opt-in system PCRE2 mode - #735

Open
stevegrubb wants to merge 3 commits into
openvinotoolkit:masterfrom
stevegrubb:system-pcre2-v2
Open

stevegrubb wants to merge 3 commits into
openvinotoolkit:masterfrom
stevegrubb:system-pcre2-v2

Conversation

@stevegrubb

Copy link
Copy Markdown
Contributor

OpenVINO Tokenizers always declares and populates its pinned PCRE2 source through FetchContent. This prevents network-free system-package builds and can put a second PCRE2 implementation into a process that already uses the system library.

Add a default-off ENABLE_SYSTEM_PCRE2 option. When enabled, use pkg-config's libpcre2-8 module and link its imported target. Report actionable errors when pkg-config or the PCRE2 development metadata is unavailable. Define the target at project scope so every Tokenizers subdirectory can use it without exposing a GLOBAL target to embedding projects. With the option off, retain the existing pinned FetchContent behavior. Both paths continue to use 8-bit PCRE2 code units.

OpenVINO Tokenizers always declares and populates its pinned PCRE2 source through FetchContent. This prevents network-free system-package builds and can put a second PCRE2 implementation into a process that already uses the system library.

Add a default-off ENABLE_SYSTEM_PCRE2 option. When enabled, use pkg-config's libpcre2-8 module and link its imported target. Report actionable errors when pkg-config or the PCRE2 development metadata is unavailable. Define the target at project scope so every Tokenizers subdirectory can use it without exposing a GLOBAL target to embedding projects. With the option off, retain the existing pinned FetchContent behavior. Both paths continue to use 8-bit PCRE2 code units.

Co-authored-by: Artur Paniukov <chgk1101@gmail.com>
Comment thread CMakeLists.txt

# Define the imported target here so every Tokenizers subdirectory can
# use it without leaking a GLOBAL target into an embedding project.
pkg_check_modules(PCRE2 QUIET IMPORTED_TARGET libpcre2-8)

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Could we use a project-specific pkg-config prefix here, such as OV_TOKENIZERS_PCRE2? When this project is included through add_subdirectory(), a parent may already define the generic PkgConfig::PCRE2 target.

@apaniukov

Copy link
Copy Markdown
Collaborator

build_jenkins

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants