blob: 8ede79b725264c4c28aba4f7c3dc91b3d352d8e8 (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
|
From 3df7febd497f345222ea05159571aff0facb6915 Mon Sep 17 00:00:00 2001
From: Martchus <martchus@gmx.net>
Date: Tue, 26 Apr 2022 20:16:31 +0200
Subject: [PATCH 11/12] Allow using properties of PkgConfig targets for glib2
to handle deps of static glib2
Change-Id: I37d20256d17ae9cc0775e32aa479f1e433ece908
---
.../find-modules/FindGLIB2.cmake | 22 +++++++++++++++----
1 file changed, 18 insertions(+), 4 deletions(-)
diff --git a/cmake/3rdparty/extra-cmake-modules/find-modules/FindGLIB2.cmake b/cmake/3rdparty/extra-cmake-modules/find-modules/FindGLIB2.cmake
index a6a16b494f..a5da57824c 100644
--- a/cmake/3rdparty/extra-cmake-modules/find-modules/FindGLIB2.cmake
+++ b/cmake/3rdparty/extra-cmake-modules/find-modules/FindGLIB2.cmake
@@ -52,7 +52,7 @@
#=============================================================================
find_package(PkgConfig QUIET)
-pkg_check_modules(PC_GLIB2 QUIET glib-2.0)
+pkg_check_modules(PC_GLIB2 QUIET glib-2.0 IMPORTED_TARGET)
find_path(GLIB2_INCLUDE_DIRS
NAMES glib.h
@@ -64,14 +64,14 @@ find_library(GLIB2_LIBRARIES
HINTS ${PC_GLIB2_LIBDIR}
)
-pkg_check_modules(PC_GTHREAD2 QUIET gthread-2.0)
+pkg_check_modules(PC_GTHREAD2 QUIET gthread-2.0 IMPORTED_TARGET)
find_library(GTHREAD2_LIBRARIES
NAMES gthread-2.0
HINTS ${PC_GTHREAD2_LIBDIR}
)
-pkg_check_modules(PC_GOBJECT QUIET gobject-2.0)
+pkg_check_modules(PC_GOBJECT QUIET gobject-2.0 IMPORTED_TARGET)
find_path(GLIB2_GOBJECT_INCLUDE_DIRS
NAMES glib-object.h
@@ -83,7 +83,7 @@ find_library(GLIB2_GOBJECT_LIBRARIES
HINTS ${PC_GOBJECT_LIBDIR}
)
-pkg_check_modules(PC_GIO QUIET gio-2.0)
+pkg_check_modules(PC_GIO QUIET gio-2.0 IMPORTED_TARGET)
find_path(GLIB2_GIO_INCLUDE_DIRS
NAMES gio/gio.h
@@ -160,6 +160,20 @@ mark_as_advanced(GLIB2_INCLUDE_DIRS GLIB2_INCLUDE_DIR
GLIB2_GIO_INCLUDE_DIRS GLIB2_GIO_INCLUDE_DIR
GLIB2_GIO_LIBRARIES GLIB2_GIO_LIBRARY)
+option(GLIB2_USE_PKG_CONFIG "Use properties from PkgConfig targets" OFF)
+if(GLIB2_USE_PKG_CONFIG)
+ foreach(TARGET_NAME GLIB2 GOBJECT GIO)
+ if(TARGET "GLIB2::${TARGET_NAME}")
+ foreach(PROP_NAME INTERFACE_LINK_OPTIONS INTERFACE_LINK_LIBRARIES
+ INTERFACE_COMPILE_OPTIONS INTERFACE_COMPILE_DEFINITIONS
+ INTERFACE_INCLUDE_DIRECTORIES)
+ get_target_property(PROP_VAL "PkgConfig::PC_${TARGET_NAME}" "${PROP_NAME}")
+ set_target_properties("GLIB2::${TARGET_NAME}" PROPERTIES "${PROP_NAME}" "${PROP_VAL}")
+ endforeach()
+ endif()
+ endforeach()
+endif()
+
include(FeatureSummary)
set_package_properties(GLIB2 PROPERTIES
URL "https://wiki.gnome.org/Projects/GLib"
--
2.37.3
|