summaryrefslogtreecommitdiffstats
path: root/cmake
Commit message (Collapse)AuthorAgeFilesLines
* qdevice.pri: Use cmake separators for the pathMårten Nordheim2021-09-111-0/+2
| | | | | | | | | | Because otherwise we may end up with trailing backslashes Change-Id: I7ad24ec34c35f0a7b32241751bbcd2b26a8a23ea Reviewed-by: Alexey Edelev <alexey.edelev@qt.io> Reviewed-by: Joerg Bornemann <joerg.bornemann@qt.io> (cherry picked from commit a2653331330340c4f44457c49005f4c7226b8316) Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
* Avoid implicit linking of plugin init library if finalizers were calledAlexey Edelev2021-09-101-0/+2
| | | | | | | | | | | | | | | Propagating of plugin init libraries should take into account plugin finalizers to avoid duplicating of object files in a linker line. Fixes: QTBUG-96062 Change-Id: I48feac94b08a7eb08d84134e9e9ae6e7214f5bdd Reviewed-by: Alexandru Croitor <alexandru.croitor@qt.io> (cherry picked from commit 7e794d71c0bf0f6e812aa1c7794b709889f202fd) Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org> (cherry picked from commit 2ad29c0a3ae1252c6c30eaca2aa06c131a67f819) Reviewed-by: Tatiana Borisova <tatiana.borisova@qt.io> Reviewed-by: Alexey Edelev <alexey.edelev@qt.io>
* CMake: Allow opting out of building examples as ExternalProjectsAlexandru Croitor2021-09-063-2/+16
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | We default to configuring examples as separate ExternalProjects when using a developer / non-prefix Qt build. This ensures we test that the examples configure successfully without the pollution of the main Qt build (e.g. already found packages). One down-side of this is that a developer's IDE doesn't see these example targets, unless each project is loaded into the IDE separately. This is cumbersome to do when refactoring or renaming code across multiple example projects. Allow configuring the example projects as part of the main Qt build by setting QT_BUILD_EXAMPLES_AS_EXTERNAL to FALSE when configuring Qt. Save the value of the variable in QtBuildInternalsExtra.cmake.in so it's propagated to leaf repositories as well. Amends dab8f64b6d5d4241b678d0227355858071376496 Amends d97fd7af2bc5c89a0ad9e5fac080041b78d01179 Task-number: QTBUG-90820 Task-number: QTBUG-94608 Task-number: QTBUG-96232 Task-number: QTCREATORBUG-26168 Change-Id: Ie1f724f74365b3a788b04c3fffe9eb2d0611dd50 Reviewed-by: Craig Scott <craig.scott@qt.io> Reviewed-by: Qt CI Bot <qt_ci_bot@qt-project.org> (cherry picked from commit c8dbb177f03bcd8e65b8fac1008fe276fada2c92) Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
* CMake: Fix 'Cannot find source file' error with older CMakesAlexandru Croitor2021-09-061-0/+5
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Configuring a static plugin init library with CMake versions earlier than 3.18.0 fails at generation phase with CMake Error at Qt6CoreMacros.cmake:2071 (add_library): Cannot find source file: example/plugins/basictools/pnp_basictools_init.cpp Call Stack (most recent call first): qtbase/lib/cmake/Qt6Core/Qt6CoreMacros.cmake:1998 (_qt_internal_add_library) qtbase/lib/cmake/Qt6/QtPublicPluginHelpers.cmake:243 (qt6_add_library) qtbase/lib/cmake/Qt6Core/Qt6CoreMacros.cmake:1967 (__qt_internal_add_static_plugin_init_object_library) qtbase/lib/cmake/Qt6Core/Qt6CoreMacros.cmake:1989 (qt6_add_plugin) qtbase/plugins/basictools/CMakeLists.txt:1 (qt_add_plugin) Marking the generated file as GENERATED explicitly solves the issue. Similar to e2c6f2ba7ed72195d12e9882c174e59a53317097 Fixes: QTBUG-96197 Change-Id: If730a1fcbe6910d6041eb6eba03d6e45a025c424 Reviewed-by: Joerg Bornemann <joerg.bornemann@qt.io> (cherry picked from commit d7c6d69a8c54d4ac3b6872f619dfefe2c47377b1) Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
* CMake: Don't cache QT_SYNCQT across buildsJoerg Bornemann2021-09-032-10/+13
| | | | | | | | | | | | | | | | | | | | | | | There is no need for this variable to be stored in CMake's cache. We don't perform expensive operations to set up QT_SYNCQT, and we even unset the cache variable to ensure it gets recomputed on reconfiguration. We still store QT_SYNCQT in a global property, because the function qt_ensure_sync_qt is called in different directory scopes, and we want to avoid re-calculations for every subdir. It's now possible for the user to set QT_SYNCQT (see QTBUG-88088 for motivation). Also, in a non-prefix build, changes to syncqt.pl in the source dir are reflected upon re-configuration in the build tree (because qt_copy_or_install is called on every configure). Fixes: QTBUG-88088 Task-number: QTBUG-75290 Change-Id: I6137b060d200d3dafd4a64d5a6c1bd2549723d78 Reviewed-by: Alexandru Croitor <alexandru.croitor@qt.io> (cherry picked from commit 60f36007a361f4102a9cc0ceb65040ebc19d2653) Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
* wasm: fail when configuring for wasm and EMSDK is not foundLorn Potter2021-09-011-1/+6
| | | | | | | Change-Id: Ic7fb933d8c2b42c3ba84a3b5a6c89a808d971bd1 Reviewed-by: Joerg Bornemann <joerg.bornemann@qt.io> (cherry picked from commit 375c7c47ff29d40ace4b489738510fac96997c21) Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
* Update Android default SDK from 29 to 30Juha Vuolle2021-08-271-1/+1
| | | | | | | | | | | | By the time of Qt 6.2 release all new apps targeting Play store must target API level 30 (Android 11) or above (starting in 08/2021 for new apps and 11/2021 for existing apps' updates). Task-number: QTBUG-94451 Change-Id: Id7fa2fd62899a7259e365c917292c6c3ac0d2b0d Reviewed-by: Assam Boudjelthia <assam.boudjelthia@qt.io> (cherry picked from commit 17d7a8dc2e2df577a769cd84cba946a726e8872a) Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
* Call MinGW's ld with -Bstatic when requesting static runtime linkageJoerg Bornemann2021-08-271-1/+1
| | | | | | | | | | | | The -static argument we used before is supported by ld, but not lld. The latter requires --static or -Bstatic. Use -Bstatic, which is supported by both. Fixes: QTBUG-89549 Change-Id: I3c3069661bf4cd20e3298aff4714163b7419d3ef Reviewed-by: Alexandru Croitor <alexandru.croitor@qt.io> (cherry picked from commit d94652f7927945f988f2c99cee98076efd5c1d79) Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
* CMake: Warn when PRIVATE_MODULE_INTERFACE is provided with no targetAlexandru Croitor2021-08-271-2/+10
| | | | | | | | | | | | | Warn if the PRIVATE_MODULE_INTERFACE option is provided a value, but there is no ${target}Private target to set the interface dependencies on. Task-number: QTBUG-95921 Change-Id: I7d4df9cb3aa9b7746d836b82019ecdd9c8f50fdc Reviewed-by: Alexey Edelev <alexey.edelev@qt.io> Reviewed-by: Alexandru Croitor <alexandru.croitor@qt.io> (cherry picked from commit 0dbf73e3deb9727da0376abf131d764251969114) Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
* CMake: Properly export MODULE_PLUGIN_TYPESAlexandru Croitor2021-08-262-1/+4
| | | | | | | | | | | | | | | | | Don't export the MODULE_PLUGIN_TYPES property only when a module has an associated configure.cmake file with features. Instead, always export it if a module defines a plugin type. This fixes qttools DesignerTargets.cmake file to contain the plugin types it defines, given that the Designer lib does not declare any features via a configure.cmake file. Task-number: QTBUG-95668 Change-Id: Ic036c31768e03b51d3bce9c2afe48e04f69f435b Reviewed-by: Michal Klocek <michal.klocek@qt.io> Reviewed-by: Alexandru Croitor <alexandru.croitor@qt.io> (cherry picked from commit d806ce6fc57cf402668ecf73aa8531be5f201f9c) Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
* Add missing PRIVATE_MODULE_INTERFACEs to INTERNAL_MODULEsAlexey Edelev2021-08-242-0/+10
| | | | | | | | | | | | | | | To detect the internal module ouside the qt_internal_add_module function need to mark it with the property. This adds _qt_is_internal_module property to the Qt internal modules. Since PRIVATE_MODULE_INTERFACE only was applicable to pure Private modules, INTERNAL_MODULEs is missing those dependencies if they were specified. Add extra condition to qt_internal_extend_target to link PRIVATE_MODULE_INTERFACE libraries to internal modules as well. Change-Id: I9c32fa5bad3aff365f5d7663349e5365d5f1d72d Reviewed-by: Alexandru Croitor <alexandru.croitor@qt.io> (cherry picked from commit abb19da5727c63783c64caefa11562a9086b4707) Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
* CMake: Create plugin initializers for static user pluginsAlexandru Croitor2021-08-241-2/+8
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Previously we only created object library static plugin initializers for Qt plugins only, not user-project plugins. The reason was that if a user tried to install the plugin target via an export set, CMake would error out saying that the _init library is not part of the same export set. Introduce an OUTPUT_TARGETS option that would allow projects to get the name of the generated _init target, so they can install it if needed. This was already done for qt6_add_qml_module, so we just introduce the same option for qt6_add_plugin. Now user static plugins will have an _init target created, which will be propagated to consumers whenever the consumers link against the plugin itself. We also need an internal option to disable this propagation, because it's handled a bit differently for Qt plugins which can be linked either via finalizers or via usage requirements. Amends 91c65dd80cdd2de666448c14202c0c63718152b6 As a result of the implementation change, cleanup example projects to ensure that they build successfully (the important part is specifying the CLASS_NAME). Only plugandpaint works properly with both shared and static Qt builds. echoplugin works with a shared Qt build, but not a static one due to some assumptions in the C++ code about shared plugins. styleplugin doesn't seem to work properly neither with shared Qt builds nor static Qt builds, at least on macOS. But it builds fine. For some reason even if the plugin is found, the style is not applied. Amends 4caac1feea025b0ad496141e8f16ab88c04c2caa Task-number: QTBUG-80863 Task-number: QTBUG-92933 Change-Id: I6f631cda9566229b7a63992b23d7d7fa50303eeb Reviewed-by: Qt CI Bot <qt_ci_bot@qt-project.org> Reviewed-by: Alexey Edelev <alexey.edelev@qt.io> Reviewed-by: Alexandru Croitor <alexandru.croitor@qt.io> (cherry picked from commit 3c1125d9fe41332087ab6213a5514426109ead08) Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
* CMake: Fix excessive size of precompiled header filesJoerg Bornemann2021-08-241-3/+3
| | | | | | | | | | | | | | | | Do not add catch-all header files like QtCore, QtGui, etc. to precompiled headers for targets that already define their own set of precompiled header files. This reduces the size of the precompiled headers and brings the pch file sizes down into the region of the qmake build. Task-number: QTBUG-89122 Change-Id: I8e4d17aa6829c7d7b1aa01a01a61b6677e22c460 Reviewed-by: Alexey Edelev <alexey.edelev@qt.io> Reviewed-by: Alexandru Croitor <alexandru.croitor@qt.io> (cherry picked from commit 278368b523e974665b60d22a0eaf27d9ed130078) Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
* Add missing -help argument to qt-configure-moduleJoerg Bornemann2021-08-201-0/+22
| | | | | | | | | | | | Now it's possible to display a configure help screen per module with qt-configure-module <module-source-dir> -help Fixes: QTBUG-95943 Change-Id: I7d26006246af4b38b5a2ec6deca3f45c5313afec Reviewed-by: Alexey Edelev <alexey.edelev@qt.io> Reviewed-by: Alexandru Croitor <alexandru.croitor@qt.io> (cherry picked from commit 1ac947e3af42f8a93d9c85a4bce4f242085c4173) Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
* Fix our usage of CMake script mode in Windows configureJoerg Bornemann2021-08-201-19/+14
| | | | | | | | | | | | | | | | | | | | | | | | | | | This is a preparation for adding the -help argument to qt-configure-module.bat. Consider the call qt-configure-module.bat path/to/qt-module -help Internally, we called cmake ... -P .../QtWriteArgsFile.cmake path/to/qt-module -help which was supposed to separate the arguments and write them into config.opt. However, passing arbitrary arguments after "-P script.cmake" only worked by accident and is not supported. As soon as arguments are passed that are valid CMake arguments, like -help or -G, the CMake call would fail. Now, we let configure.bat and qt-configure-module.bat write the arguments as is into config.opt.in and let QtWriteArgsFile.cmake read this file, separate the arguments and write config.opt. Task-number: QTBUG-95943 Change-Id: I80f298a2aaf55b0f79fed86320a055eb2d2b6faa Reviewed-by: Alexey Edelev <alexey.edelev@qt.io> Reviewed-by: Alexandru Croitor <alexandru.croitor@qt.io> (cherry picked from commit 57ad532e75f62212f24dd2791583b975d09aca9d) Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
* Fix Android -ltcg buildJoerg Bornemann2021-08-201-2/+8
| | | | | | | | | | | | | | | We're passing -Oz for release builds, but that's not a flag the linker understands when -ltcg is enabled. The build fails with: ld.gold: fatal error: Optimization level must be between 0 and 3 Fix this by using -O2, which -Oz is based on, and -O3 for the "full optimization" that is used for core and gui. Fixes: QTBUG-89472 Change-Id: Ie1a86888baefce5ca97026e7d635f10d2819f9f4 Reviewed-by: Alexandru Croitor <alexandru.croitor@qt.io> (cherry picked from commit 80de5165658e1cfb12d0813ea93dcfecca0dcb45) Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
* CMake: Fix QT_ADDITIONAL_PACKAGES_PREFIX_PATH for cross-buildsAlexandru Croitor2021-08-195-16/+93
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | The QT_ADDITIONAL_PACKAGES_PREFIX_PATH variable was introduced to allow specifying extra locations to find Qt packages. The reason it was introduced instead of just using CMAKE_PREFIX_PATH is because the Qt6 component find_package call uses NO_DEFAULT_PATH which means CMAKE_PREFIX_PATH is ignored. We use NO_DEFAULT_PATH to ensure we don't accidentally pick up system / distro Qt packages. The paths from QT_ADDITIONAL_PACKAGES_PREFIX_PATH are added to the find_package PATHS option in the Qt6 package, each ModuleDependencies.cmake file and some other places. Unfortunately that's not enough to make it work for cross-builds. Imagine the following scenario. host qtbase, qtdeclarative installed in /host_qt target qtbase installed in /target_qtbase target qtdeclarative installed in /target_qtdeclarative We want to cross-build qtlottie. We configure qtlottie as follows /target_qtbase/bin/qt-configure-module /qtlottie_src -- -DQT_ADDITIONAL_PACKAGES_PREFIX_PATH=/target_qtdeclarative We expect the target QtQuick package to be found, but it won't be. The reason is that QT_ADDITIONAL_PACKAGES_PREFIX_PATH is added to the PATHs option, but we don't adjust CMAKE_FIND_ROOT_PATH. Without adding the new paths in CMAKE_FIND_ROOT_PATH, CMake will re-root the passed PATHs under the existing CMAKE_FIND_ROOT_PATH, which is QT_TOOLCHAIN_RELOCATABLE_INSTALL_PREFIX, which evaluates to /target_qtbase. There is no QtQuick package there. To fix this, prepend the values of QT_ADDITIONAL_PACKAGES_PREFIX_PATH to CMAKE_FIND_ROOT_PATH. The location where we currently do CMAKE_FIND_ROOT_PATH manipulations is in the qt.toolchain.cmake file, so to be consistent, we prepend the new prefixes there as well. We need to adjust both CMAKE_FIND_ROOT_PATH and CMAKE_PREFIX_PATH, due the path re-rooting bug in CMake. See https://gitlab.kitware.com/cmake/cmake/-/issues/21937 as well as the existing comment in qt.toolchain.cmake marked with REROOT_PATH_ISSUE_MARKER. We also need to do a few more things to make the setup work Because Qt6Config uses NO_DEFAULT_PATH, the CMAKE_PREFIX_PATH adjustments we do in the toolchain file are not enough, so we still need to add the same prefixes to the Qt6Config find_package PATHS option. One would ask why do we need to adjust CMAKE_PREFIX_PATH at all then. It's for find_package(Qt6Foo) calls to work which don't go through the Qt6Config umbrella package. To make the CMake re-rooting behavior happy, we need to ensure the provided paths are absolute. So we iterate over the values of QT_ADDITIONAL_PACKAGES_PREFIX_PATH, to make them absolute. We do the same for the environment variable. We need to append lib/cmake to the prefixes which are added to CMAKE_PREFIX_PATH, otherwise the CMake re-rooting bug is hit. We need to specify the Qt6 package location (${_qt_cmake_dir}) to the PATHS option in the various Dependencies.cmake.in files, to ensure that dependency resolution can jump around between the Qt6 dir and the additional prefixes. Previously the dependency lookup code assumed that all dependencies would be within the same prefix. The same is needed for qt and qml plugin dependency lookup. Amends 7bb91398f25cb2016c0558fd397b376f413e3e96 Amends 60c87c68016c6f02b0eddd4002f75a49ab51d4a8 Amends 5bbd700124d13a292ff8bae6045316112500e230 Fixes: QTBUG-95854 Change-Id: I35ae82330fec427d0d38fc9a0542ffafff52556a Reviewed-by: Alexey Edelev <alexey.edelev@qt.io> Reviewed-by: Joerg Bornemann <joerg.bornemann@qt.io> (cherry picked from commit 6b6d42f6b814ab7814c795744fd6212b9b4d54fb) Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
* CMake: Pass Qt6_FIND_VERSION in Qt6Config when looking for componentsAlexandru Croitor2021-08-193-2/+10
| | | | | | | | | | | | | | | | | | | | | | | | Pass Qt6_FIND_VERSION to components when the find_package(Qt6 ${ver} COMPONENTS Foo) signature is used. Create a ConfigVersion file for BuildInternals, so that BuildInternals passes the version check. Fix qt_configure_file to look in the _qt_6_config_cmake_dir folder for the template file rather than Qt6_DIR, because Qt6_DIR might be accidentally unset after a failed find_package(Qt6) call and the error is not helpful then. We already pass versions everywhere else when looking for dependencies, like in ModuleDependencies.cmake.in, PluginDependencies.cmake.in, ModuleToolsDependencies.cmake.in. Fixes: QTBUG-91737 Change-Id: Ief1da0c6f239c935385e7ce662951e85ccfdf130 Reviewed-by: Qt CI Bot <qt_ci_bot@qt-project.org> Reviewed-by: Joerg Bornemann <joerg.bornemann@qt.io> (cherry picked from commit 654431286931a70645fc3be39570f9109c95fe9e) Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
* CMake: Don't backup cmake prefix when there are no tool dependenciesAlexandru Croitor2021-08-191-2/+2
| | | | | | | | | | This is just a minor optimization. Change-Id: Icf0fc615895e1def63c57a72694c89f7ae7ee5cf Reviewed-by: Alexey Edelev <alexey.edelev@qt.io> Reviewed-by: Joerg Bornemann <joerg.bornemann@qt.io> (cherry picked from commit d65ccd399929ae51f192655f23b521904767bbcf) Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
* Remove unnecessary version of module from _MODULE_DEPENDENCIESAlexey Edelev2021-08-191-1/+10
| | | | | | | | | | | | | | | _<module>_MODULE_DEPENDENCIES variable in the <module>Dependnecies.cmake should only contain the list of targets that module depends on, but not versions. Version of the first module appears in the list because of the regression introduced in 425ff34aa10a02524f2d52f544dc00b539ef9a26 Amends 425ff34aa10a02524f2d52f544dc00b539ef9a26 Change-Id: Iaa42120af6bac742bdf0f8d389bd8e5bdef9c1d1 Reviewed-by: Alexandru Croitor <alexandru.croitor@qt.io> (cherry picked from commit 2059d294eb525fe23d1a7681a1563efb513fe31e) Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
* CMake: Don't install metatypes files for user projectsAlexandru Croitor2021-08-191-6/+5
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Installing extracted metatypes json files for user projects was an oversight. We shouldn't install anything on behalf of user projects, but rather give them enough information so they can do it the themselves. Make all the install options of qt6_extract_metatypes internal, change the behavior not to install the files by default, unless __QT_INTERNAL_INSTALL is passed, which is used for the Qt build only. __QT_INTERNAL_NO_INSTALL is now a no-op and should be removed from projects. This is behavior change for existing public API, but it's better to fix this now before 6.2.0 release. Introduce a new OUTPUT_FILES option to allow assigning the extracted metatype file paths into a variable that the project provides. The project can then install the files where they need them. [ChangeLog][CMake] qt6_extract_metatypes does not install metatypes files anymore. Instead the OUTPUT_FILES option can be provided to get the list of extracted files for further processing. Task-number: QTBUG-95845 Change-Id: If5dd0255a5fea2b598e15118c29ec2ab2ba4324e Reviewed-by: Alexey Edelev <alexey.edelev@qt.io> Reviewed-by: Qt CI Bot <qt_ci_bot@qt-project.org> Reviewed-by: Fabian Kosmale <fabian.kosmale@qt.io> (cherry picked from commit e7455644a28e4d4b569a1f3fee421d9eeed00d3d) Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
* CMake: Include quiet packages in feature summaryAlexandru Croitor2021-08-181-1/+2
| | | | | | | | | | | | | This will show packages that were found (or not) with find_package(QUIET) in summary just before the configure summary. It's useful for CI logs to determine whether some Qt packages was not found when cross-compiling. Change-Id: Ic7d5062cf061f7c60b5c74374f957065dd8029f5 Reviewed-by: Joerg Bornemann <joerg.bornemann@qt.io> (cherry picked from commit a52b24ac39648b343555de7aff83ffa234958529) Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
* Pick up *Tools components also from host QtKai Köhne2021-08-181-0/+27
| | | | | | | | | | | | | | | | | | | | | | | | | | | Let find_package(Qt6 COMPONENTS LinguistTools) for a cross-compiled Qt fall back to search LinguistTools in the host Qt. Use the same trick as in QtModuleDependencies.cmake: Prepend both CMAKE_PREFIX_PATH and CMAKE_FIND_ROOT_PATH with the QT_HOST_PATH (respective ${QT_HOST_PATH}/lib/cmake). Furthermore adding ${QT_HOST_PATH}/lib/cmake to PATHS argument makes sure that find_package will work even with NO_DEFAULT_PATH. Make sure not to match ShaderTools and Tools packages. ShaderTools is the cross-compiled package, the host package name is ShaderToolsTools. Tools is the cross-compiled module from qttools. Allow an opt out via a QT_NO_FIND_HOST_TOOLS_PATH_MANIPULATION variable in case that we accidentally match more packages ending in Tools that are actually cross-compiled packages. Fixes: QTBUG-95602 Change-Id: Ib0a787716fa529e36f22356da069e705d9eed5fa Reviewed-by: Joerg Bornemann <joerg.bornemann@qt.io> (cherry picked from commit d2359b2d4e5db6c42158d536d6e2a2af5ea1e59c) Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
* configure: Fix iOS option to be passed for both platform and xplatformAlexandru Croitor2021-08-171-1/+3
| | | | | | | | Task-number: QTBUG-95838 Change-Id: If0617e1d9c47595d4a350a91ab4f7d47546ebf08 Reviewed-by: Joerg Bornemann <joerg.bornemann@qt.io> (cherry picked from commit 3d2dc88850b6ba030238791dcd4a4ec44bb2479d) Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
* CMake: Save value of QT_UIKIT_SDK in QtBuildInternalsExtra.cmakeAlexandru Croitor2021-08-171-0/+5
| | | | | | | | | | | | | | | | The value of QT_UIKIT_SDK is used in configure tests via qt_config_compile_test -> qt_get_platform_try_compile_vars. Up till now QT_UIKIT_SDK was only available in qtbase only. Save the value in BuildInternals to ensure it's used for other repos as well. Change-Id: I46f372267782f1c8e7d48c237fe0264ac72d33bb Task-number: QTBUG-95838 Reviewed-by: Joerg Bornemann <joerg.bornemann@qt.io> (cherry picked from commit 67dae9e6ee1c17cbdbfd015b43e27a41a8040409) Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
* CMake: Remove deprecated CFBundleLongVersionString from Info.plistAlexandru Croitor2021-08-172-4/+0
| | | | | | | | | | | | | The CFBundleLongVersionString Info.plist entry has been deprecated and removed from Apple documentation for a long time now. Remove it. Task-number: QTBUG-95838 Change-Id: I4e4f74e00d678fd67875976c8884a80cdbb8cec4 Reviewed-by: Tor Arne Vestbø <tor.arne.vestbo@qt.io> (cherry picked from commit ae6a8ddf45567c12bcb2e100756dcf9430010677) Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
* CMake: Fix building iOS projects with a single-arch Qt buildAlexandru Croitor2021-08-171-3/+24
| | | | | | | | | | | | | | | | | | | | | Automatically set the CMAKE_OSX_SYSROOT and CMAKE_OSX_ARCHITECTURES values with the ones Qt was configured with, when configuring a user project with the Xcode generator and a single arch / sdk Qt build. This ensures that calling xcodebuild from the command line chooses the correct architecture and SDK when building the project. Allow to opt out of this behavior by passing QT_NO_SET_OSX_ARCHITECTURES and QT_NO_SET_OSX_SYSROOT. Amends 55a15a1c1b93d36d705fc69e44b5c806b807dd55 Amends a6a3b82ffb3d7f1ea13293206401ed360a51e9cd Task-number: QTBUG-95838 Change-Id: Ifab16e9eee3100a9b80a2a14b3ea29ba8d9aa6fc Reviewed-by: Joerg Bornemann <joerg.bornemann@qt.io> (cherry picked from commit fe40e08da4edc0728b305e6068f86b1818136d88) Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
* CMake: Suggest "ninja install" for multi-config buildsJoerg Bornemann2021-08-171-0/+7
| | | | | | | | | | | | The configure summary now suggests "ninja install" for Ninja Multi-Config builds, because "cmake --install ." does not install all configurations. See CMake upstream issue #21475. Change-Id: Ie3129a906945db9d09c6772ce66ec7239797b8fc Reviewed-by: Kai Koehne <kai.koehne@qt.io> Reviewed-by: Alexandru Croitor <alexandru.croitor@qt.io> (cherry picked from commit 153fd84c8a686dc0483a2e830683ef012c9a3156) Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
* CMake: Fix feature evaluation for feature definesJoerg Bornemann2021-08-171-1/+6
| | | | | | | | | | | | | | | | | | Passing -DFEATURE_developer_build=TRUE did not add the define QT_BUILD_INTERNAL to src/corelib/global/qconfig.h like -DFEATURE_developer_build=ON would. This happened, because the feature evaluation in qt_evaluate_feature_definition did a string comparison against "ON". Normalize both sides of the string comparison, and thus support all booly values for features. Fixes: QTBUG-95732 Change-Id: Ibf03579c05919b35219438361fc93676b7cca7cc Reviewed-by: Alexandru Croitor <alexandru.croitor@qt.io> (cherry picked from commit eafbda41910b8bcf69223dec2b7750671b692348) Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
* CMake: Make precompiled headers work for Android on WindowsJoerg Bornemann2021-08-171-0/+9
| | | | | | | | | | | | | | | When building Qt for Android on Windows, the precompile_headers test failed if the source directory was passed as absolute path without drive letter. See CMake upstream issue #22534. Work around the CMake issue by ensuring that the path is properly prefixed with a drive letter. Fixes: QTBUG-95652 Change-Id: I3154b6c0bb2f53533306227074b24fbbf5973b05 Reviewed-by: Alexandru Croitor <alexandru.croitor@qt.io> (cherry picked from commit b43afd5315dc8f78bda4331a66886ca61a3e8dce) Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
* CMake: Replace usage of WIN32 with CMAKE_HOST_WIN32 in qconfig.cppAlexandru Croitor2021-08-171-1/+1
| | | | | | | | | | | | | | The workaround of adding a drive letter to QT_CONFIGURE_PREFIX_PATH_STR should be done when running on any Windows host, not only when targeting Windows. Amends 59c3be711728ab0aa644bfdf50e91a1b020f95bb Task-number: QTBUG-87580 Change-Id: Ic6ca50aa58a4a54fb483e90fe61a907fe86cb002 Reviewed-by: Joerg Bornemann <joerg.bornemann@qt.io> (cherry picked from commit 6ef3d070a8bad0cfba98fa241a8676401f21371f) Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
* CMake: Save QT_BUILD_BENCHMARKS and other info in BuildInternalsExtraAlexandru Croitor2021-08-171-0/+7
| | | | | | | | | | | So that those values are used when configuring other repos in a per-repo build arrangement. Change-Id: I5ff86260116c52afc87d7fcd5cbd047fcb9dde22 Reviewed-by: Mitch Curtis <mitch.curtis@qt.io> Reviewed-by: Joerg Bornemann <joerg.bornemann@qt.io> (cherry picked from commit 48fa7f53cc36cf660a9c9a504239eaa99939756b) Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
* CMake: Exclude dSYM INSTALL commands for already excluded tools in debugMartin Vejdarski2021-08-173-3/+35
| | | | | | | | | | | | | | | | | | | | | | | | | | Debug tools are excluded from the ALL target for debug_and_release builds. However, when using the -separate-debug-info option, the same exclusion wasn't being applied for their dSYM INSTALL commands, resulting in a CMake install error. Pass any additional install args like EXCLUDE_FROM_ALL COMPONENT "ExcludedExecutables" to the installation rules of qt_enable_separate_debug_info and install dSYMs for executables per-config in a multi-config build. All the non-main config executable install rules are optional because the non-main config executables are excluded from ALL. Amends 5b136abd21803988f96b9b66c992822efbef97ec Fixes: QTBUG-93999 Change-Id: I95c3ce28215c3ee535551e4b7a5fa9731f8f1c28 Reviewed-by: Alexandru Croitor <alexandru.croitor@qt.io> Reviewed-by: Joerg Bornemann <joerg.bornemann@qt.io> (cherry picked from commit 3c148323c08cff1487211c18beda90ae2c6ef508) Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
* CMake: Use __qt_internal_propagate_object_library for static pluginsAlexandru Croitor2021-08-141-6/+5
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Address TODO and use the new helper __qt_internal_propagate_object_library function instead of target_sources when linking static plugin initializers via usage requirements. Note that to work correctly this depends on using the target_link_options object library linking approach, which means a minimum CMake version of 3.17, which is already the case for static Qt usage. With CMake 3.21, it will use target_link_libraries approach instead. With CMake version 3.16 or lower, currently, this won't work correctly on Linux if there are dependencies wrapped in genexes because the __qt_internal_propagate_object_library call will try to use the still-by-default-enabled 'object_libraries' finalizer mode via __qt_internal_collect_dependency_object_libraries and that stops the usage of the target_sources approach to link the object files directly. This isn't a big deal though, because we already require CMake 3.20 as the minimum. It might be a bigger deal if we will need any of this functionality to work with 3.16 in shared Qt builds where the user project tries to create and link against custom static plugins. But that's already likely to be a can of worms even without this specific edge case. Amends a37957df5c1d3d8624fae2222734a127ec340a72 Amends 91c65dd80cdd2de666448c14202c0c63718152b6 Uses 3329212815777e33dfb4697b748d10927d73f44c Task-number: QTBUG-92933 Change-Id: I8710e79eee265d820f65c8ccc3d0bd0c0ee6eccd Reviewed-by: Joerg Bornemann <joerg.bornemann@qt.io> (cherry picked from commit dfabb5b6775b21b98ba86cb93cb0d41173878f1b) Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
* CMake: Remove qt6_enable_object_libraries_finalizer_modeAlexandru Croitor2021-08-141-19/+6
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | qt6_enable_object_libraries_finalizer_mode is not needed anymore now that static Qt builds require CMake 3.21 and thus CMake takes care of placing object library object files at the beginning of the link line. Rename qt6_enable_import_plugins_finalizer_mode to a more generic qt6_set_finalizer_mode that can enable or disable multiple different modes. For now the only available mode is "static_plugins" which handles the behavior of the old function name. The mode can be enabled by calling qt6_set_finalizer_mode(${target} ENABLE MODES "static_plugins") Note that the function is re-tagged as being in Technical Preview. Ideally we would not need it at all. But we need to provide some workaround for the limitations of linking Qt static plugins in CMake on Linux-y platforms that use bfd ld or ld.gold. The workaround does not work well with dependencies wrapped in generator expressions which is why we can't confidently advertise it as a proper solution. Our hope is that this can be fixed in future upstream CMake versions and the function can be removed. See 6fcc272ac9dcf1d6d65de1bdf3138722ba63a902 for details. Adjust the tests due to the renamed and removed functions. Amends 19e789bace887105badae83c0a79429bbf8e8221 Amends cdbb390c4a9b8d53cfcfd0884e6720423ce5e126 Amends a25027eecb3829a65543d0e8ab00c74e1b1a21c5 Amends 6fcc272ac9dcf1d6d65de1bdf3138722ba63a902 Amends a3c430f390b379d874916d4c9ff02af5323af1bd Fixes: QTBUG-95169 Task-number: QTBUG-95601 Task-number: QTBUG-95603 Change-Id: I51b85f776ec29fc04fed1a637eba7d1f60609e69 Reviewed-by: Joerg Bornemann <joerg.bornemann@qt.io> (cherry picked from commit 5161d8d525650ac74a3571b13bb8b35dbf413e59) Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
* CMake: Warn if qt_internal_plugin(target) does not end with 'Plugin'Kai Köhne2021-08-131-2/+7
| | | | | | | | | | | | | | | The logic for linking plugins in a static build in Qt6*Plugins.cmake looks up plugins that are named Qt6*PluginConfig.cmake, and the file name is computed by the target name. Not naming the target 'Plugin' therefore means it won't be picked up in static builds. Task-number: QTBUG-95731 Change-Id: Ic83a29d7c91492c302eb413a69577a0c550e1a1b Reviewed-by: Joerg Bornemann <joerg.bornemann@qt.io> (cherry picked from commit d6661c56222250f75de64cda09aab1f3837db58c) Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
* Make Android detection more robustJoerg Bornemann2021-08-131-11/+22
| | | | | | | | | | | | | | | | | | | Our only way to detect whether the user requests an Android build of Qt was to peek into the CMake toolchain file if it is specified. If the toolchain file contains a certain magic string, we decide that we're building for Android. This approach is fragile and bound to break should the Android toolchain file's magic string ever change. Now, we assume an Android build if any of our ANDROID_* cache variables is set. In that case, we do not peek into the toolchain file. Fixes: QTBUG-94955 Change-Id: Ie2f0ac0963f90f09805e311111bb6912d4325ada Reviewed-by: Alexandru Croitor <alexandru.croitor@qt.io> (cherry picked from commit 6fec7eae319c7d737c1df585a66a151a654f723b) Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
* CMake: Warn when using CMake 3.21.0 due to issue in AUTOMOC/AUTOUICAlexandru Croitor2021-08-121-0/+7
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | There can be cases where trying to incrementally rebuild an already built Qt will cause a ninja dependency cycle error due to incorrect dependency information created by AUTOMOC and AUTOUIC. Example error when building qtscxml tests ninja: error: dependency cycle: auto/scxmlcoutput/default/tst_scxmlcoutput_default_autogen/timestamp -> auto/scxmlcoutput/default/ids1.h -> auto/scxmlcoutput/default/tst_scxmlcoutput_default_autogen -> auto/scxmlcoutput/default/CMakeFiles/tst_scxmlcoutput_default_autogen -> auto/scxmlcoutput/default/tst_scxmlcoutput_default_autogen/timestamp Example error when building Qt Creator ninja: error: dependency cycle: src/shared/help/shared_help_autogen/include/ui_filternamedialog.h -> src/shared/help/shared_help_autogen/timestamp -> src/shared/help/shared_help_autogen/include/ui_filternamedialog.h Warn and advise to use a different CMake version instead. Change-Id: I6f529ba6a526663bc6ed699b1bfe8a9094129887 Reviewed-by: Craig Scott <craig.scott@qt.io> Reviewed-by: Alexandru Croitor <alexandru.croitor@qt.io> (cherry picked from commit 06c2400f5d439ce1f1945833d9b1895eff843855) Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
* Copy Find*.cmake to ${QT_BUILD_DIR}/lib/cmake/Qt6Li Xinwei2021-08-101-0/+7
| | | | | | | | | | | | | | | | | | | | | In top-level builds, when configuring qtsensors, the directory of FindWMF.cmake isn't in ${CMAKE_MODULE_PATH}, this makes CMake couldn't find WMF. On Windows, QtMultimedia requires WMF. If WMF couldn't be found, QtMultimedia will also be treated as NOT FOUND. QtSensors has an optional dependency to QtMultimedia. If QtMultimedia couldn't be found, CMake will warn. Copy Find*.cmake to ${QT_BUILD_DIR}/lib/cmake/Qt6, to make sure these files could be found by CMake. Fixes: QTBUG-95655 Change-Id: I87d14c9a7becd0ec493e00c297b2e01fc0ad0f96 Reviewed-by: Alexandru Croitor <alexandru.croitor@qt.io> (cherry picked from commit 1a8de144b64fe665d3c0b34e329c9454d97e1523) Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
* CMake: Fix qt_find_package to work when CMP00126 is set to NEWAlexandru Croitor2021-08-101-12/+20
| | | | | | | | | | | | | | | | | | | | | | | | | | When CMP00126 is set to NEW, set(CACHE) doesn't remove regular variable bindings with the same name as the cache variable. This introduced an issue in qt_find_package, which called find_package(CONFIG QUIET) to try and find a package config file, but did not clean up the non-cache _FOUND variable which is automatically set to 0 by CMake if no Config file is found. Make sure to unset both the regular and cache _FOUND variables if either the package config file was not found, or if none of the provided targets found even if the Config file was found. Also move the _DIR cache variable cleaning into the same code block. Amends 4c31ce68d5367a6ec4dd3cf2f55e4b226add876d Amends 34b1c1c23cbddf67f878579bee9d10dcac29d8ca Fixes: QTBUG-95635 Change-Id: I871987217526e0f0a20038a8da52625838e49488 Reviewed-by: Craig Scott <craig.scott@qt.io> Reviewed-by: Alexandru Croitor <alexandru.croitor@qt.io> (cherry picked from commit 72a1e55472d0780996cc3843039b00427b5a420b) Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
* CMake: Fix build with CMake master / 3.22Alexandru Croitor2021-08-101-1/+1
| | | | | | | | | | | | | | | | | CMake master / 3.22 introduced a behavior change in how conditions are evaluated in the while command. It is now consistent with how if() evaluates conditions. This caused an issue in Qt code where a "(" opening parenthesis was evaluated as part of the condition rather than as a string. Fix this by wrapping the evaluation of the variable in quotes. Change-Id: I70c26dc91394f4a14f7a26419df264a069dc7dc5 Reviewed-by: Kai Koehne <kai.koehne@qt.io> Reviewed-by: Craig Scott <craig.scott@qt.io> (cherry picked from commit eb2282605734152440e840777d1f8a0576e3c7a6) Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
* Remove dysfunctional -coverage configure argumentJoerg Bornemann2021-08-101-1/+0
| | | | | | | | | | | | | | | The -coverage argument merely added compiler flags for the Qt build. It was never properly ported to the CMake build, and it doesn't seem feasible to have configure arguments for every possible compiler option. The same can be achieved by passing the needed compiler option to CMake, for example: CMAKE_CXX_FLAGS=-fsanitize-coverage=trace-pc-guard Fixes: QTBUG-86227 Change-Id: Ieef9acaedc0a839f9fb35b4403395eea28643864 Reviewed-by: Alexandru Croitor <alexandru.croitor@qt.io> (cherry picked from commit 0e92ec972840e78b6f38d0f554ec1554edf752d1) Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
* CMake: Rename qt6_add_plugin TYPE option to PLUGIN_TYPEAlexandru Croitor2021-08-062-9/+20
| | | | | | | | | | | | | | The intention is to remove TYPE as a keyword completely before 6.2.0 release, but in case if that's not possible due to the large amount of repositories and examples, just print a deprecation warning for now and handle both TYPE and PLUGIN_TYPE. Task-number: QTBUG-95170 Change-Id: If0c18345483b9254b0fc21120229fcc2a2fbfbf5 Reviewed-by: Qt CI Bot <qt_ci_bot@qt-project.org> Reviewed-by: Joerg Bornemann <joerg.bornemann@qt.io> (cherry picked from commit b2f00dfb46af633b00946cb1ebfe963964f803ca) Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
* CMake: Partially fix QUIETness of find_package(Qt6 COMPONENTS Foo)Alexandru Croitor2021-08-061-1/+5
| | | | | | | | | | | | | | | | | | | | | | | | | | When Qt5Config.cmake was ported to Qt6, the assignment of _Qt6_FIND_PARTS_QUIET was accidentally left out. Make sure that when find_package(Qt6 QUIET COMPONENTS Foo) is called, the underlying component find_package(Qt6Foo) call gets a QUIET option as well. This will silence short-form warnings like -- Could NOT find Qt6Foo (missing: Qt6Foo_DIR) It currently won't silence any warnings produced by the transitive find_package calls in QtModuleDependencies.cmake. That will require a separate change. Remove usage of _Qt6_FIND_PARTS_REQUIRED which was always empty. See details of QTBUG-95573 why it's currently not used. Task-number: QTBUG-95573 Change-Id: I3822c068eecbe84c306a1b04f4187278d35ec3d5 Reviewed-by: Joerg Bornemann <joerg.bornemann@qt.io> (cherry picked from commit 7d86cf02c1f3341056ea9463e93ad336e0e63a52) Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
* CMake: Improve component / package not found error messagesAlexandru Croitor2021-08-062-13/+48
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Provide better error messages when a Qt package / component is not found. Mention the location of the expected Config file on the file system, whether it exists Also mention the location of the Config file that was specified by the user when configuring the project or which CMake computed and stored in QtModule_DIR cache var. Mention that a package is not found in case if the main target exposed by that package is not found. If the target is not found, mention that it might be due to QT_NO_CREATE_TARGETS being set to TRUE (when it is set to true). If it is set to true, the assumption is that the target must have been defined by something else before the find_package call (either an earlier find_package call without QT_NO_CREATE_TARGETS set to TRUE or maybe it's the use case of Qt being built together with its examples or it's a super build). Unset _Qt_NOTFOUND_MESSAGE to ensure that the Qt6 not found error message is not spilled into any subsequent find_package(Qt6) calls, causing a cascade of unwarranted warnings / errors. Make sure to unset it only if components were specified, so the message is not shown or unset in any of the recursive find_package(Qt6) calls which is a dependency for regular Qt module packages. This works fine, because find_package(Qt6) calls with components are only done in project code and not done by the transitive dependency code (which looks for Qt6Foo packages directly). Remove some dead code. Task-number: QTBUG-95532 Change-Id: Ie93d18e25e33aa0fe9e9da9a60e3d3e4cd6adb58 Reviewed-by: Joerg Bornemann <joerg.bornemann@qt.io> (cherry picked from commit 825cb50c27fc0942a76771f9fb2ec052dc9142bf) Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
* CMake: Enforce minimum CMake version in user projectsAlexandru Croitor2021-08-047-50/+195
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | This change introduces new behavior to error out when configuring user projects if the CMake version used is too old for Qt to work with. The main motivator is the requirement of new CMake features to ensure object libraries are placed in the proper place on the link line in static builds. The minimum CMake version is computed based on whether Qt was configured as shared or static libraries. At the moment the required versions for building and using Qt are the same. The minimum versions are defined in qtbase/.cmake.conf in the following variables QT_SUPPORTED_MIN_CMAKE_VERSION_FOR_BUILDING_QT_SHARED QT_SUPPORTED_MIN_CMAKE_VERSION_FOR_BUILDING_QT_STATIC QT_SUPPORTED_MIN_CMAKE_VERSION_FOR_USING_QT_SHARED QT_SUPPORTED_MIN_CMAKE_VERSION_FOR_USING_QT_STATIC Qt Packagers can disable the version check when configuring Qt by setting QT_FORCE_MIN_CMAKE_VERSION_FOR_BUILDING_QT and QT_FORCE_MIN_CMAKE_VERSION_FOR_USING_QT. In this case it is the packagers responsibility to ensure such a Qt works correctly with the specified CMake version. User projects can also set QT_FORCE_MIN_CMAKE_VERSION_FOR_USING_QT to disable the version check. Then it's the project's developer responsibility to ensure such a Qt works correctly. No official support is provided for these cases. Implementation notes. The versions required to build Qt are stored in QtBuildInternalsExtra.cmake whereas the versions required to use Qt are stored in a new QtConfigExtras.cmake. Also the policy range variables stored in QtBuildInternalsExtra.cmake are now regular variables instead of cache variables, to properly allow overrides per-repository. Some renaming of functions and variables was done for a bit more clarity and easier grep-ability. Task-number: QTBUG-95018 Change-Id: I4279f2e10b6d3977319237ba21e2f4ed676aa48b Reviewed-by: Alexey Edelev <alexey.edelev@qt.io> Reviewed-by: Joerg Bornemann <joerg.bornemann@qt.io> (cherry picked from commit 6518bcc167d47e1c27d082c21551b9a838b04e5d) Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
* CMake: Bump min required CMake version for static Qt builds to 3.20Alexandru Croitor2021-08-041-13/+27
| | | | | | | | | | | | | | | | | | | | | | | | Building a static library Qt configuration will now require a minimum CMake version of 3.20. Qt builders and packagers can still opt out of the mentioned minimum required version by configuring Qt with QT_FORCE_MIN_CMAKE_VERSION. Such a Qt configuration is /NOT SUPPORTED/. To facilitate these changes, the minimum version check has been moved to happen after the BUILD_SHARED_LIBS option is computed by either QtAutoDetect.cmake or set by a user provided cmake toolchain file. Introduce a new QT_MIN_SUPPORTED_CMAKE_VERSION_FOR_STATIC_QT variable in .cmake.conf to mark the minimum version for a static Qt build. Task-number: QTBUG-95018 Change-Id: Idc1875729f26a7c635b6bd26ac0c1be973917c13 Reviewed-by: Joerg Bornemann <joerg.bornemann@qt.io> Reviewed-by: Alexey Edelev <alexey.edelev@qt.io> Reviewed-by: Craig Scott <craig.scott@qt.io> (cherry picked from commit 9aa0d99e66b8be2be75d4f3b7fce2b94db9a1e32) Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
* Avoid to call _qt_internal_set_up_static_runtime_library() twiceLi Xinwei2021-08-034-4/+2
| | | | | | | Change-Id: I28985470b3e0b88befbbd2d62a027670d7d6c822 Reviewed-by: Alexandru Croitor <alexandru.croitor@qt.io> (cherry picked from commit a25144394910d07d0819c4da5aae058b0912a312) Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
* CMake: Bump min required CMake version for shared Qt builds to 3.16Alexandru Croitor2021-08-021-1/+1
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Building a shared library Qt configuration already required a minimum CMake version of 3.16, because we depend on CMake's Autogen.json files which are used for metatype.json file generation. If a lower version was used, a FATAL_ERROR was issued in qt6_extract_metatypes. This change is essentially moving the check to happen earlier in the qtbase configure process. User projects will now /also/ officially require a minimum of 3.16 (up from 3.14). As a consequence, the min/max version policy range that is set in the public QtFooConfig.cmake files is changed from 3.14..3.19 to 3.16..3.20 The upper bound is raised because building and using Qt works fine with all CMake 3.20 policies set to NEW. [ChangeLog][CMake] Building Qt as shared libraries now requires CMake version 3.16 or later. Building user projects with CMake using that Qt installation also requires a CMake version of 3.16 or later. Task-number: QTBUG-95018 Change-Id: I77d2829370f1dfc90b4071bebc8a3ade654e59e6 Reviewed-by: Alexey Edelev <alexey.edelev@qt.io> Reviewed-by: Alexandru Croitor <alexandru.croitor@qt.io> Reviewed-by: Craig Scott <craig.scott@qt.io> Reviewed-by: Qt CI Bot <qt_ci_bot@qt-project.org> (cherry picked from commit 42970e490af00cd9baff1c54f4f00d982b21586a) Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
* testlib: Update a few remaining instances of the deprecated -xunitxml formatTor Arne Vestbø2021-07-301-1/+1
| | | | | | | | | The format was renamed in 27db9e458cef512fca3a6b5c9ebbcda7a8172428. Change-Id: I53975c7467d8768dc9dc9ac2d89c42eefa12e22f Reviewed-by: Mårten Nordheim <marten.nordheim@qt.io> (cherry picked from commit 7c14223b1e21a3e19a0f84c772c0c8ca49dfe74f) Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>