MESSAGE("PCRE2_INSTALL_DIR: " $ENV{PCRE2_INSTALL_DIR})
find_library(PCRE2_LIBRARIES NAMES pcre2 pcre2-8 pcre2d pcre2-8d PATHS "$ENV{PCRE2_INSTALL_DIR}/lib")
find_library(PCRE2_POSIX_LIBRARIES NAMES pcre2-posix pcre2-posix-8 pcre2-posixd pcre2-posix-8d PATHS "$ENV{PCRE2_INSTALL_DIR}/lib")
find_path(PCRE2_INCLUDE_DIRS pcre2.h PATHS "$ENV{PCRE2_INSTALL_DIR}/include")
if(PCRE2_LIBRARIES AND PCRE2_INCLUDE_DIRS)
  message(STATUS "PCRE2 libs: ${PCRE2_LIBRARIES}")
  message(STATUS "PCRE2 include directory: ${PCRE2_INCLUDE_DIRS}")
  set(PCRE2_FOUND TRUE CACHE BOOL "Found PCRE2 libraries" FORCE)
  add_custom_target(pcre2)
else()
  set(PCRE2_FOUND FALSE CACHE BOOL "Found PCRE2 libraries" FORCE)
  message(STATUS "PCRE2 library not found.")
endif()
