Skip to content

Commit

Permalink
pcre.cmake: always check the library with check_library_exists()
Browse files Browse the repository at this point in the history
even if pkg-config has it. otherwise build dependencies
aren't detected.
  • Loading branch information
vuvova committed Feb 1, 2024
1 parent 2278f35 commit 15c75ad
Showing 1 changed file with 3 additions and 6 deletions.
9 changes: 3 additions & 6 deletions cmake/pcre.cmake
Expand Up @@ -81,18 +81,15 @@ MACRO (CHECK_PCRE)
FIND_PACKAGE(PkgConfig QUIET)
PKG_CHECK_MODULES(PCRE libpcre2-8)
# in case pkg-config or libpcre2-8.pc is not installed:
IF(NOT PCRE_FOUND)
UNSET(PCRE_FOUND CACHE)
CHECK_LIBRARY_EXISTS(pcre2-8 pcre2_match_8 "" PCRE_FOUND)
ENDIF()
CHECK_LIBRARY_EXISTS(pcre2-8 pcre2_match_8 "${PCRE_LIBRARY_DIRS}" HAVE_PCRE2_MATCH_8)
ENDIF()
IF(NOT PCRE_FOUND OR WITH_PCRE STREQUAL "bundled")
IF(NOT HAVE_PCRE2_MATCH_8 OR WITH_PCRE STREQUAL "bundled")
IF (WITH_PCRE STREQUAL "system")
MESSAGE(FATAL_ERROR "system pcre2-8 library is not found or unusable")
ENDIF()
BUNDLE_PCRE2()
ELSE()
CHECK_LIBRARY_EXISTS(pcre2-posix PCRE2regcomp "" NEEDS_PCRE2_DEBIAN_HACK)
CHECK_LIBRARY_EXISTS(pcre2-posix PCRE2regcomp "${PCRE_LIBRARY_DIRS}" NEEDS_PCRE2_DEBIAN_HACK)
IF(NEEDS_PCRE2_DEBIAN_HACK)
SET(PCRE2_DEBIAN_HACK "-Dregcomp=PCRE2regcomp -Dregexec=PCRE2regexec -Dregerror=PCRE2regerror -Dregfree=PCRE2regfree")
ENDIF()
Expand Down

0 comments on commit 15c75ad

Please sign in to comment.