diff options
Diffstat (limited to 'cmake/FindWrapPCRE2.cmake')
-rw-r--r-- | cmake/FindWrapPCRE2.cmake | 20 |
1 files changed, 20 insertions, 0 deletions
diff --git a/cmake/FindWrapPCRE2.cmake b/cmake/FindWrapPCRE2.cmake new file mode 100644 index 0000000000..b69c5078a5 --- /dev/null +++ b/cmake/FindWrapPCRE2.cmake @@ -0,0 +1,20 @@ +include_guard(GLOBAL) # pragma once equivalent + +find_package(PCRE2 CONFIG QUIET) + +if(PCRE2_FOUND AND TARGET PCRE2::pcre2-16) + # Hunter case. + add_library(WrapPCRE2::WrapPCRE2 INTERFACE IMPORTED) + target_link_libraries(WrapPCRE2::WrapPCRE2 INTERFACE PCRE2::pcre2-16) + set(WrapPCRE2_FOUND TRUE) +else() + find_library(PCRE2_LIBRARIES NAMES pcre2-16) + find_path(PCRE2_INCLUDE_DIRS pcre2.h) + + if (PCRE2_LIBRARIES AND PCRE2_INCLUDE_DIRS) + add_library(WrapPCRE2::WrapPCRE2 INTERFACE IMPORTED) + target_link_libraries(WrapPCRE2::WrapPCRE2 INTERFACE ${PCRE2_LIBRARIES}) + target_include_directories(WrapPCRE2::WrapPCRE2 INTERFACE ${PCRE2_INCLUDE_DIRS}) + set(WrapPCRE2_FOUND TRUE) + endif() +endif() |