vcpkg/ports/qtbase/GLIB2-static.patch
jim wang 4746870785
[qtbase] fix glib2 not found (#30379)
* fix glib2 no found

* update version

* update version

* update version

* update version

* update version

* update version

* update version

* update version

* update verion

* update verion

* merge master

* version

* fix new error

* update version

* update version

* update version

* Update qtbase.json

---------

Co-authored-by: Jim Wang (Beyondsoft Corporation) <v-wangjim@microsoft.com>
2023-05-08 16:40:12 -07:00

104 lines
4.6 KiB
Diff

diff --git a/cmake/3rdparty/extra-cmake-modules/find-modules/FindGLIB2.cmake b/cmake/3rdparty/extra-cmake-modules/find-modules/FindGLIB2.cmake
index 24a194c..91c8e41 100644
--- a/cmake/3rdparty/extra-cmake-modules/find-modules/FindGLIB2.cmake
+++ b/cmake/3rdparty/extra-cmake-modules/find-modules/FindGLIB2.cmake
@@ -95,6 +95,18 @@ find_library(GLIB2_GIO_LIBRARIES
HINTS ${PC_GIO_LIBDIR}
)
+pkg_check_modules(PC_GMODULE QUIET gmodule-2.0)
+
+find_path(GLIB2_GMODULE_INCLUDE_DIRS
+ NAMES gmodule.h
+ HINTS ${PC_GMODULE}
+ PATH_SUFFIXES glib-2.0)
+
+find_library(GLIB2_GMODULE_LIBRARIES
+ NAMES gmodule-2.0
+ HINTS ${PC_GMODULE}
+)
+
# search the glibconfig.h include dir under the same root where the library is found
get_filename_component(glib2LibDir "${GLIB2_LIBRARIES}" PATH)
@@ -126,6 +138,11 @@ if(GLIB2_GIO_LIBRARIES AND GLIB2_GIO_INCLUDE_DIRS)
set(GLIB2_GIO_FOUND TRUE)
endif()
+if(GLIB2_GMODULE_LIBRARIES AND GLIB2_GMODULE_INCLUDE_DIRS)
+ set(GLIB2_GMODULE_FOUND TRUE)
+endif()
+
+
include(FindPackageHandleStandardArgs)
find_package_handle_standard_args(GLIB2
REQUIRED_VARS GLIB2_LIBRARIES GTHREAD2_LIBRARIES GLIB2_INCLUDE_DIRS
@@ -137,6 +154,16 @@ if(GLIB2_FOUND AND NOT TARGET GLIB2::GLIB2)
IMPORTED_LOCATION "${GLIB2_LIBRARIES}"
INTERFACE_LINK_LIBRARIES "${GTHREAD2_LIBRARIES}"
INTERFACE_INCLUDE_DIRECTORIES "${GLIB2_INCLUDE_DIRS}")
+ #vcpkg specific
+ pkg_check_modules(PC_PCRE2_8BIT QUIET libpcre2-8)
+ find_library(PCRE2_8BIT_LIBRARIES
+ NAMES pcre2-8
+ HINTS ${PC_PCRE2_8BIT}
+ )
+ target_link_libraries(GLIB2::GLIB2 INTERFACE ${PCRE2_8BIT_LIBRARIES})
+ find_package(Iconv)
+ find_package(Intl)
+ target_link_libraries(GLIB2::GLIB2 INTERFACE Intl::Intl Iconv::Iconv)
endif()
if(GLIB2_GOBJECT_FOUND AND NOT TARGET GLIB2::GOBJECT)
@@ -153,12 +180,21 @@ if(GLIB2_GIO_FOUND AND NOT TARGET GLIB2::GIO)
INTERFACE_INCLUDE_DIRECTORIES "${GLIB2_GIO_INCLUDE_DIRS}")
endif()
+if(GLIB2_GMODULE_FOUND AND NOT TARGET GLIB2::GMODULE)
+ add_library(GLIB2::GMODULE UNKNOWN IMPORTED)
+ set_target_properties(GLIB2::GMODULE PROPERTIES
+ IMPORTED_LOCATION "${GLIB2_GMODULE_LIBRARIES}"
+ INTERFACE_INCLUDE_DIRECTORIES "${GLIB2_GMODULE_INCLUDE_DIRS}")
+endif()
+
+
mark_as_advanced(GLIB2_INCLUDE_DIRS GLIB2_INCLUDE_DIR
GLIB2_LIBRARIES GLIB2_LIBRARY
GLIB2_GOBJECT_INCLUDE_DIRS GLIB2_GOBJECT_INCLUDE_DIR
GLIB2_GOBJECT_LIBRARIES GLIB2_GOBJECT_LIBRARY
GLIB2_GIO_INCLUDE_DIRS GLIB2_GIO_INCLUDE_DIR
- GLIB2_GIO_LIBRARIES GLIB2_GIO_LIBRARY)
+ GLIB2_GIO_LIBRARIES GLIB2_GIO_LIBRARY
+ GLIB2_GMODULE_LIBRARIES GLIB2_GMODULE_INCLUDE_DIRS)
include(FeatureSummary)
set_package_properties(GLIB2 PROPERTIES
diff --git a/src/corelib/configure.cmake b/src/corelib/configure.cmake
index 7d52f48..2b1b221 100644
--- a/src/corelib/configure.cmake
+++ b/src/corelib/configure.cmake
@@ -25,7 +25,7 @@ endif()
qt_find_package(WrapSystemDoubleConversion
PROVIDED_TARGETS WrapSystemDoubleConversion::WrapSystemDoubleConversion
MODULE_NAME core QMAKE_LIB doubleconversion)
-qt_find_package(GLIB2 PROVIDED_TARGETS GLIB2::GLIB2 MODULE_NAME core QMAKE_LIB glib)
+qt_find_package(GLIB2 PROVIDED_TARGETS GLIB2::GLIB2 MODULE MODULE_NAME core QMAKE_LIB glib)
qt_find_package(ICU 50.1 COMPONENTS i18n uc data PROVIDED_TARGETS ICU::i18n ICU::uc ICU::data
MODULE_NAME core QMAKE_LIB icu)
diff --git a/src/network/configure.cmake b/src/network/configure.cmake
index aef7f15..21b0c1d 100644
--- a/src/network/configure.cmake
+++ b/src/network/configure.cmake
@@ -10,8 +10,8 @@
qt_find_package(WrapBrotli PROVIDED_TARGETS WrapBrotli::WrapBrotliDec MODULE_NAME network QMAKE_LIB brotli)
qt_find_package(Libproxy PROVIDED_TARGETS PkgConfig::Libproxy MODULE_NAME network QMAKE_LIB libproxy)
qt_find_package(GSSAPI PROVIDED_TARGETS GSSAPI::GSSAPI MODULE_NAME network QMAKE_LIB gssapi)
-qt_find_package(GLIB2 OPTIONAL_COMPONENTS GOBJECT PROVIDED_TARGETS GLIB2::GOBJECT MODULE_NAME core QMAKE_LIB gobject)
-qt_find_package(GLIB2 OPTIONAL_COMPONENTS GIO PROVIDED_TARGETS GLIB2::GIO MODULE_NAME core QMAKE_LIB gio)
+qt_find_package(GLIB2 OPTIONAL_COMPONENTS GOBJECT PROVIDED_TARGETS GLIB2::GOBJECT MODULE MODULE_NAME core QMAKE_LIB gobject)
+qt_find_package(GLIB2 OPTIONAL_COMPONENTS GIO PROVIDED_TARGETS GLIB2::GIO MODULE MODULE_NAME core QMAKE_LIB gio)
#### Tests