qt5base-lts/cmake/FindWrapPCRE2.cmake
Cristian Adam 527f3bb31c CMake: Add WrapPCRE2 package
The WrapPCRE2 package handles the PCRE2 packages that have targets,
and reuse them.

Change-Id: I24b0b51f507703cd8287f845f7e425f62dd2c3d6
Reviewed-by: Alexandru Croitor <alexandru.croitor@qt.io>
2019-06-05 09:42:55 +00:00

21 lines
713 B
CMake

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()