summaryrefslogtreecommitdiffstats
path: root/.prev_configure.cmake
diff options
context:
space:
mode:
authorAlexandru Croitor <alexandru.croitor@qt.io>2021-04-13 18:57:07 +0200
committerQt Cherry-pick Bot <cherrypick_bot@qt-project.org>2021-04-19 20:13:58 +0000
commit93dbd93809656259b1e30576182814572bb86204 (patch)
tree6826897c75d16de0a3abbe211aba402260721e09 /.prev_configure.cmake
parent3cdcb53a37bbdbd42f5da2b22d3adeba3cd9ed9a (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. Change-Id: I8bd8649be4f680a331ad51925f27cb9d13ac5e5f Reviewed-by: Cristian Adam <cristian.adam@qt.io> (cherry picked from commit b25eb6e0bd1e3b91c44dc4892d529b95c8677889) Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
Diffstat (limited to '.prev_configure.cmake')
-rw-r--r--.prev_configure.cmake4
1 files changed, 2 insertions, 2 deletions
diff --git a/.prev_configure.cmake b/.prev_configure.cmake
index 8f8c71926f..4449901b12 100644
--- a/.prev_configure.cmake
+++ b/.prev_configure.cmake
@@ -6,7 +6,7 @@
#### Libraries
-qt_find_package(ZLIB 1.0.8 PROVIDED_TARGETS ZLIB::ZLIB MODULE_NAME global QMAKE_LIB zlib)
+qt_find_package(WrapZLIB 1.0.8 PROVIDED_TARGETS WrapZLIB::WrapZLIB MODULE_NAME global QMAKE_LIB zlib)
qt_find_package(ZSTD 1.3 PROVIDED_TARGETS ZSTD::ZSTD MODULE_NAME global QMAKE_LIB zstd)
qt_find_package(WrapDBus1 1.2 PROVIDED_TARGETS dbus-1 MODULE_NAME global QMAKE_LIB dbus)
qt_find_package(Libudev PROVIDED_TARGETS PkgConfig::Libudev MODULE_NAME global QMAKE_LIB libudev)
@@ -839,7 +839,7 @@ qt_feature("stack-protector-strong" PRIVATE
)
qt_feature("system-zlib" PRIVATE
LABEL "Using system zlib"
- CONDITION ZLIB_FOUND
+ CONDITION WrapZLIB_FOUND
)
qt_feature("zstd" PRIVATE
LABEL "Zstandard support"