summaryrefslogtreecommitdiff
path: root/src/svg
diff options
context:
space:
mode:
authorAlexandru Croitor <alexandru.croitor@qt.io>2020-02-25 11:27:17 +0100
committerAlexandru Croitor <alexandru.croitor@qt.io>2020-03-06 00:31:50 +0100
commit7ad4f9db2700db57352fae98631bade347567ebd (patch)
tree947865d612f1b878150bc4e45171583a1658b3c0 /src/svg
parent53a7436262a5bb6a96026b576e2660efb718b2b5 (diff)
downloadqtsvg-7ad4f9db2700db57352fae98631bade347567ebd.tar.gz
CMake: Handle zlib dependency correctly
Unfortunately whenever a module or plugin uses zlib, the .pro file contains a copy-pasted conditional scope when to use system zlib and when to use the Qt bundled zlib. The pro2cmake script handles the linking part, but not the find_package part. We need to explicitly search for the correct package depending on whether system zlib feature is on or off, and also make sure not to search for the system one in case it already exists (can happen in static builds). Change-Id: I9c0d678815e4dc0f8e239c3b4667a375aeb757c1 Reviewed-by: Simon Hausmann <simon.hausmann@qt.io>
Diffstat (limited to 'src/svg')
-rw-r--r--src/svg/.prev_CMakeLists.txt11
-rw-r--r--src/svg/CMakeLists.txt20
2 files changed, 28 insertions, 3 deletions
diff --git a/src/svg/.prev_CMakeLists.txt b/src/svg/.prev_CMakeLists.txt
index 30ed3e1..bf9e056 100644
--- a/src/svg/.prev_CMakeLists.txt
+++ b/src/svg/.prev_CMakeLists.txt
@@ -23,7 +23,6 @@ qt_add_module(Svg
LIBRARIES
Qt::CorePrivate
Qt::GuiPrivate
- ZLIB::ZLIB
PUBLIC_LIBRARIES
Qt::Core
Qt::Gui
@@ -51,6 +50,16 @@ qt_extend_target(Svg CONDITION MSVC AND (TEST_architecture_arch STREQUAL "i386")
#### Keys ignored in scope 4:.:.:svg.pro:solaris-cc_x_:
# QMAKE_CXXFLAGS_RELEASE = "--O2"
+
+qt_extend_target(Svg CONDITION QT_FEATURE_system_zlib
+ LIBRARIES
+ ZLIB::ZLIB
+)
+
+qt_extend_target(Svg CONDITION NOT QT_FEATURE_system_zlib
+ LIBRARIES
+ Qt::ZlibPrivate
+)
qt_add_docs(Svg
doc/qtsvg.qdocconf
)
diff --git a/src/svg/CMakeLists.txt b/src/svg/CMakeLists.txt
index 49d8531..241b5fc 100644
--- a/src/svg/CMakeLists.txt
+++ b/src/svg/CMakeLists.txt
@@ -4,7 +4,14 @@
## Svg Module:
#####################################################################
-find_package(ZLIB MODULE REQUIRED) # special case
+# special case begin
+# Handle the conditional finding of either system zlib or qt zlib.
+if(NOT QT_FEATURE_system_zlib)
+ find_package(Qt6 COMPONENTS Zlib)
+elseif(NOT TARGET ZLIB::ZLIB)
+ qt_find_package(ZLIB PROVIDED_TARGETS ZLIB::ZLIB)
+endif()
+# special case end
qt_add_module(Svg
SOURCES
@@ -25,7 +32,6 @@ qt_add_module(Svg
LIBRARIES
Qt::CorePrivate
Qt::GuiPrivate
- ZLIB::ZLIB
PUBLIC_LIBRARIES
Qt::Core
Qt::Gui
@@ -53,6 +59,16 @@ qt_extend_target(Svg CONDITION MSVC AND (TEST_architecture_arch STREQUAL "i386")
#### Keys ignored in scope 4:.:.:svg.pro:solaris-cc_x_:
# QMAKE_CXXFLAGS_RELEASE = "--O2"
+
+qt_extend_target(Svg CONDITION QT_FEATURE_system_zlib
+ LIBRARIES
+ ZLIB::ZLIB
+)
+
+qt_extend_target(Svg CONDITION NOT QT_FEATURE_system_zlib
+ LIBRARIES
+ Qt::ZlibPrivate
+)
qt_add_docs(Svg
doc/qtsvg.qdocconf
)