diff options
Diffstat (limited to 'cmake/FindWrapSystemPCRE2.cmake')
-rw-r--r-- | cmake/FindWrapSystemPCRE2.cmake | 24 |
1 files changed, 20 insertions, 4 deletions
diff --git a/cmake/FindWrapSystemPCRE2.cmake b/cmake/FindWrapSystemPCRE2.cmake index 6d8b471f88..ce00252c8c 100644 --- a/cmake/FindWrapSystemPCRE2.cmake +++ b/cmake/FindWrapSystemPCRE2.cmake @@ -1,32 +1,48 @@ +# Copyright (C) 2022 The Qt Company Ltd. +# SPDX-License-Identifier: BSD-3-Clause + if(TARGET WrapSystemPCRE2::WrapSystemPCRE2) set(WrapSystemPCRE2_FOUND TRUE) return() endif() set(WrapSystemPCRE2_REQUIRED_VARS __pcre2_found) -find_package(PCRE2 ${${CMAKE_FIND_PACKAGE_NAME}_FIND_VERSION} CONFIG QUIET) +find_package(PCRE2 ${${CMAKE_FIND_PACKAGE_NAME}_FIND_VERSION} COMPONENTS 16BIT QUIET) -set(__pcre2_target_name "PCRE2::pcre2-16") +set(__pcre2_target_name "PCRE2::16BIT") if(PCRE2_FOUND AND TARGET "${__pcre2_target_name}") # Hunter case. set(__pcre2_found TRUE) if(PCRE2_VERSION) set(WrapSystemPCRE2_VERSION "${PCRE2_VERSION}") endif() +else() + get_cmake_property(__packages_not_found PACKAGES_NOT_FOUND) + if(__packages_not_found) + list(REMOVE_ITEM __packages_not_found PCRE2) + set_property(GLOBAL PROPERTY PACKAGES_NOT_FOUND "${__packages_not_found}") + endif() + unset(__packages_not_found) endif() if(NOT __pcre2_found) list(PREPEND WrapSystemPCRE2_REQUIRED_VARS PCRE2_LIBRARIES PCRE2_INCLUDE_DIRS) find_package(PkgConfig QUIET) - pkg_check_modules(PC_PCRE2 QUIET libpcre2-16) + pkg_check_modules(PC_PCRE2 QUIET "libpcre2-16") find_path(PCRE2_INCLUDE_DIRS NAMES pcre2.h HINTS ${PC_PCRE2_INCLUDEDIR}) - find_library(PCRE2_LIBRARIES + find_library(PCRE2_LIBRARY_RELEASE NAMES pcre2-16 HINTS ${PC_PCRE2_LIBDIR}) + find_library(PCRE2_LIBRARY_DEBUG + NAMES pcre2-16d pcre2-16 + HINTS ${PC_PCRE2_LIBDIR}) + include(SelectLibraryConfigurations) + select_library_configurations(PCRE2) + if(PC_PCRE2_VERSION) set(WrapSystemPCRE2_VERSION "${PC_PCRE2_VERSION}") endif() |