summaryrefslogtreecommitdiffstats
path: root/util
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 /util
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 'util')
-rw-r--r--util/cmake/helper.py2
1 files changed, 1 insertions, 1 deletions
diff --git a/util/cmake/helper.py b/util/cmake/helper.py
index 8917821a3e..c0063259a9 100644
--- a/util/cmake/helper.py
+++ b/util/cmake/helper.py
@@ -601,7 +601,7 @@ _library_map = [
LibraryMapping("xkbcommon", "XKB", "XKB::XKB", extra=["0.5.0"]),
LibraryMapping("xlib", "X11", "X11::X11"),
LibraryMapping("xrender", "XRender", "PkgConfig::XRender", extra=["0.6"]),
- LibraryMapping("zlib", "ZLIB", "ZLIB::ZLIB", extra=["1.0.8"]),
+ LibraryMapping("zlib", "WrapZLIB", "WrapZLIB::WrapZLIB", extra=["1.0.8"]),
LibraryMapping("zstd", "ZSTD", "ZSTD::ZSTD", extra=["1.3"]),
LibraryMapping("tiff", "TIFF", "TIFF::TIFF"),
LibraryMapping("webp", "WrapWebP", "WrapWebP::WrapWebP"),