summaryrefslogtreecommitdiffstats
path: root/src
diff options
context:
space:
mode:
authorAlexandru Croitor <alexandru.croitor@qt.io>2021-04-13 18:57:07 +0200
committerAlexandru Croitor <alexandru.croitor@qt.io>2021-04-19 20:30:45 +0200
commitb25eb6e0bd1e3b91c44dc4892d529b95c8677889 (patch)
treebcaf82a236d8b17494c8c2d2c35cbf799161bb0b /src
parented721471494aa5bffbe0a5944f8efbe62884b9b5 (diff)
CMake: Introduce zlib find script to work around hardcoded iOS SDK
Xcode allows building a project targeting either the device or simulator sysroot in one single build dir, but for the sysroot switching to work there should be no linker or compiler flags referencing absolute paths of a specific sysroot. During CMake configuration of a project targeting iOS, all found system libraries will be within one single sysroot, either the device one or the simulator one, whichever one was passed to CMAKE_OSX_SYSROOT. CMake will then generate the Xcode project and pass those absolute paths, which makes sysroot switching within Xcode not work. To avoid that, the CMake documentation recommends passing linker and framework flags of the form '-lfoo' and '-framework bar' instead of absolute paths. Xcode then takes care of setting the correct framework search path. Zlib is one of the libraries found in the iOS sysroot and thus passed as absolute path. To avoid that, create a new FindWrapZLIB find script. The target it creates will pass the absolute path to the library on non Apple platforms and an -lz linker flag on Apple platforms (macOS and iOS). To avoid issues with target global promotion when system PNG package is found, ensure that a found ZLIB::ZLIB target is promoted to global manually in src/gui/configure.cmake. Pick-to: 6.1 Change-Id: I8bd8649be4f680a331ad51925f27cb9d13ac5e5f Reviewed-by: Cristian Adam <cristian.adam@qt.io>
Diffstat (limited to 'src')
-rw-r--r--src/3rdparty/freetype/CMakeLists.txt2
-rw-r--r--src/3rdparty/libpng/CMakeLists.txt2
-rw-r--r--src/corelib/CMakeLists.txt2
-rw-r--r--src/gui/CMakeLists.txt2
-rw-r--r--src/network/CMakeLists.txt2
-rw-r--r--src/tools/bootstrap/CMakeLists.txt2
6 files changed, 6 insertions, 6 deletions
diff --git a/src/3rdparty/freetype/CMakeLists.txt b/src/3rdparty/freetype/CMakeLists.txt
index 13f2c434c0..6a9de38984 100644
--- a/src/3rdparty/freetype/CMakeLists.txt
+++ b/src/3rdparty/freetype/CMakeLists.txt
@@ -78,7 +78,7 @@ qt_internal_extend_target(BundledFreetype CONDITION QT_FEATURE_png
qt_internal_extend_target(BundledFreetype CONDITION QT_FEATURE_system_zlib
LIBRARIES
- ZLIB::ZLIB
+ WrapZLIB::WrapZLIB
)
qt_internal_extend_target(BundledFreetype CONDITION NOT QT_FEATURE_system_zlib
diff --git a/src/3rdparty/libpng/CMakeLists.txt b/src/3rdparty/libpng/CMakeLists.txt
index e07272f7c6..637ebcf548 100644
--- a/src/3rdparty/libpng/CMakeLists.txt
+++ b/src/3rdparty/libpng/CMakeLists.txt
@@ -42,7 +42,7 @@ qt_set_symbol_visibility_hidden(BundledLibpng)
qt_internal_extend_target(BundledLibpng CONDITION QT_FEATURE_system_zlib
LIBRARIES
- ZLIB::ZLIB
+ WrapZLIB::WrapZLIB
)
qt_internal_extend_target(BundledLibpng CONDITION NOT QT_FEATURE_system_zlib
diff --git a/src/corelib/CMakeLists.txt b/src/corelib/CMakeLists.txt
index 3c6b20636a..8351ec9263 100644
--- a/src/corelib/CMakeLists.txt
+++ b/src/corelib/CMakeLists.txt
@@ -692,7 +692,7 @@ qt_internal_extend_target(Core CONDITION ICC
qt_internal_extend_target(Core CONDITION QT_FEATURE_system_zlib
LIBRARIES
- ZLIB::ZLIB
+ WrapZLIB::WrapZLIB
)
qt_internal_extend_target(Core CONDITION NOT QT_FEATURE_system_zlib
diff --git a/src/gui/CMakeLists.txt b/src/gui/CMakeLists.txt
index 31e727189b..a8692318eb 100644
--- a/src/gui/CMakeLists.txt
+++ b/src/gui/CMakeLists.txt
@@ -792,7 +792,7 @@ qt_internal_extend_target(Gui CONDITION ANDROID AND TEST_architecture_arch STREQ
qt_internal_extend_target(Gui CONDITION QT_FEATURE_system_zlib
LIBRARIES
- ZLIB::ZLIB
+ WrapZLIB::WrapZLIB
)
qt_internal_extend_target(Gui CONDITION NOT QT_FEATURE_system_zlib
diff --git a/src/network/CMakeLists.txt b/src/network/CMakeLists.txt
index dc32520b32..e49b8d8930 100644
--- a/src/network/CMakeLists.txt
+++ b/src/network/CMakeLists.txt
@@ -136,7 +136,7 @@ qt_internal_extend_target(Network CONDITION QT_FEATURE_http AND QT_FEATURE_zstd
qt_internal_extend_target(Network CONDITION QT_FEATURE_system_zlib
LIBRARIES
- ZLIB::ZLIB
+ WrapZLIB::WrapZLIB
)
qt_internal_extend_target(Network CONDITION NOT QT_FEATURE_system_zlib
diff --git a/src/tools/bootstrap/CMakeLists.txt b/src/tools/bootstrap/CMakeLists.txt
index a2f0e30920..7d1a067126 100644
--- a/src/tools/bootstrap/CMakeLists.txt
+++ b/src/tools/bootstrap/CMakeLists.txt
@@ -265,7 +265,7 @@ qt_internal_extend_target(Bootstrap CONDITION CMAKE_CROSSCOMPILING OR NOT QT_FEA
qt_internal_extend_target(Bootstrap CONDITION QT_FEATURE_system_zlib AND NOT CMAKE_CROSSCOMPILING
LIBRARIES
- ZLIB::ZLIB
+ WrapZLIB::WrapZLIB
)
qt_internal_extend_target(Bootstrap CONDITION MINGW AND WIN32