summaryrefslogtreecommitdiffstats
path: root/cmake
Commit message (Collapse)AuthorAgeFilesLines
* CMake: Fix cross-build without qt.toolchain.cmakeJoerg Bornemann2022-02-181-3/+4
| | | | | | | | | | | | | If there's no qt.toolchain.cmake used, QT_HOST_PATH_CMAKE_DIR is not set. Use the location calculated from the Qt6HostInfo package in that case. This amends commit e044c94a61f0cd2bdea1e89be4ec3c68007f7a5c. Change-Id: I99aed8e920b8c1aa6efd8f18301cc34aca5559ca Reviewed-by: Alexey Edelev <alexey.edelev@qt.io> (cherry picked from commit 006224eb17d97cf5fca641d0de9900c1c60829d4) Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
* CMake: Add default launch screen storyboard for iOS appsAlexandru Croitor2022-02-164-3/+59
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Bundle a default LaunchScreen.storyboard file for an iOS app and make sure it's referenced in the generated Info.plist file. When launching Qt examples, it ensures the app uses the whole screen space on the device rather than just a square-ish part of it. The storyboard file is a copy of the qmake one, which qmake adds to the Xcode projects it generates. A custom launch screen can be provided either by setting the QT_IOS_LAUNCH_SCREEN variable or by setting the QT_IOS_LAUNCH_SCREEN target property. The value must be an absolute path to the launch screen file. The automatic addition of the launch screen entry in the Info.plist file can be prevented by setting the QT_NO_SET_IOS_LAUNCH_SCREEN variable to TRUE. The automatic bundling of the launch screen file in the application bundle can be prevented by setting the QT_NO_ADD_IOS_LAUNCH_SCREEN_TO_BUNDLE variable to TRUE. The current implementation has a limitation that only one launch screen storyboard and one iOS executable can exist within a project. If there are multiple executables in the project, all of them will use the launch screen that is specified last (the last qt_add_executable call). Because of this limitation, the API is marked as Technical Preview, to be improved upon in the future. For now it simply serves as an improvement to the out-of-the-box experience of iOS apps built with CMake. Amends 4d838dae5a821e9e5f013ba1d5a494ece1b5180e Fixes: QTBUG-95837 Change-Id: I6b067d703d635122959a1ef17fcca713da694a86 Reviewed-by: Tor Arne Vestbø <tor.arne.vestbo@qt.io> (cherry picked from commit e5b3436255ce095af58608b03b913fc9bcb8e61f) Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
* CMake: Introduce QT_ADDITIONAL_HOST_PACKAGES_PREFIX_PATHJoerg Bornemann2022-02-154-24/+77
| | | | | | | | | | | | | When installing conan packages we have one installation prefix per package. When cross-building a conan package, we need to make known those multiple host prefixes to Qt, analogous to QT_ADDITIONAL_PACKAGES_PREFIX_PATH. Fixes: QTBUG-94524 Change-Id: I68cbede350f95266a5fd3559e9b9c214c5858eed Reviewed-by: Alexandru Croitor <alexandru.croitor@qt.io> (cherry picked from commit e044c94a61f0cd2bdea1e89be4ec3c68007f7a5c) Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
* configure: Fix --foo=bar argumentsJoerg Bornemann2022-02-151-1/+1
| | | | | | | | | | | | This amends commit c5409964b0c627b25131c73f95794314feb51b5d. When detecting a variable assignment, we must ignore arguments that start with a dash. Otherwise, arguments like --prefix=~/Qt are ignored. Change-Id: I3b143113b94ca0d8af92679c1f567fbcec298349 Reviewed-by: Alexandru Croitor <alexandru.croitor@qt.io> (cherry picked from commit a3d8a359f17e35b7485770ac9a3a731900749276) Reviewed-by: Jörg Bornemann <joerg.bornemann@qt.io>
* configure: Allow specifying arbitrary variable assignmentsJoerg Bornemann2022-02-151-0/+13
| | | | | | | | | | | | | | | | It's now possible to call configure with arbitrary variable assignments "FOO=BAR" that get passed as "-DFOO=BAR" to CMake. There is no error anymore for unknown variables. CMake already warns about those: "Manually-specified variables were not used by the project: FOO". [ChangeLog][configure] Users can directly assign CMake variables with configure, for example "configure CMAKE_CXX_COMPILE=clang++-11". Fixes: QTBUG-88210 Change-Id: Ib15e63a895df717919dd2b6623fa4d284209776f Reviewed-by: Alexandru Croitor <alexandru.croitor@qt.io> (cherry picked from commit c5409964b0c627b25131c73f95794314feb51b5d) Reviewed-by: Jörg Bornemann <joerg.bornemann@qt.io>
* configure: Remove unused facility to define variable assignmentsJoerg Bornemann2022-02-151-29/+0
| | | | | | | | | | | | | | The function qt_commandline_assignment and everything related to it is removed from configure. It was only used in qtbase, and all usage has been removed. More general variable assignments will be added in a subsequent commit. Task-number: QTBUG-88210 Change-Id: I7cfa782e89914f2b0dc0277c46e425c8a825557e Reviewed-by: Alexandru Croitor <alexandru.croitor@qt.io> (cherry picked from commit 6ab16d52d282b1a370cda3f0cf0827142250ac29) Reviewed-by: Jörg Bornemann <joerg.bornemann@qt.io>
* Use 'copy' but not 'copy_if_different' on Windows platformsAlexey Edelev2022-02-104-0/+38
| | | | | | | | | | | | | | Use custom script to copy big Android artifacts on Windows platforms. The script uses 'copy' but not 'copy_if_different' when source file size is bigger than 2GB. 'cmake -E copy_if_different' only compares first 2GB of files because of cmake issue, so this step only workaround the problem. Task-number: QTBUG-99491 Change-Id: Id076734700e334dfc3330da412462c2b53829b33 Reviewed-by: Alexandru Croitor <alexandru.croitor@qt.io> Reviewed-by: Qt CI Bot <qt_ci_bot@qt-project.org> (cherry picked from commit 2201934efa1b9889d474347e705784bf6925e120)
* Add missing include of QtPublicCMakeHelpersAlexey Edelev2022-02-101-0/+1
| | | | | | | | | | | Amends 2201934efa1b9889d474347e705784bf6925e120 Task-number: QTBUG-99491 Change-Id: I449f0705f1e41fd4609008ae6a7f4107cd0a4ca6 Reviewed-by: Alexandru Croitor <alexandru.croitor@qt.io> Reviewed-by: Andreas Buhr <andreas.buhr@qt.io> (cherry picked from commit 723a4e2b89f623323b74757c5041f020dcabe891) Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
* Fix the run of _check targets in multi-config buildsAlexey Edelev2022-02-101-2/+8
| | | | | | | | | | | | With Ninja Multi-Config generator it's necessary to provide the '-C' option matching the build configuration when running ctest. This patchset adds the missing option to the command line of the '_check' targets. Change-Id: I42acfba26a09877a6d3a5be9230860f15f95a0cd Reviewed-by: Alexandru Croitor <alexandru.croitor@qt.io> (cherry picked from commit 3bee7db4198712c763dbd754bad7b2c851147038) Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
* CMake: Assign proper postfixes in multi-config buildsAlexandru Croitor2022-02-101-2/+29
| | | | | | | | | | | | | | | | | | | | | | | In a single-config build on Linux, we usually don't want a debug postfix in library names (as opposed to Windows/macOS). But when doing a multi-config build on Linux, assigning no postfixes causes CMake to generate rules for a single config only, the first one specified in CMAKE_CONFIGURATION_TYPES. This leads to being unable to build all configurations from the same build.ninja file as well as other obscure issues like race-conditions when generating prl files. To address this, when doing a multi-config build, always assign a postfix for each config except the first release-like one, while preserving the existing rules we had for debug postfix names. Fixes: QTBUG-100493 Change-Id: Ie9c88e074abdcf2961d7b3dee19a5694292717b8 Reviewed-by: Alexey Edelev <alexey.edelev@qt.io> (cherry picked from commit 90b07054f6de3ad101416b1ab5a10d7fee801a1c) Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
* configure: Switch error to warning when -skip used in per-repo buildAlexandru Croitor2022-02-101-6/+4
| | | | | | | | | | | | | | Yield a warning instead of an error that -skip and -submodules have no effect in a per-repo build. Amends acaba632605ac22aa3da4c3cf8e5891cb9cde657 Adjusts to 11ae0e772cccd3028771c1380f077c605224cc19 Change-Id: Ic26b0ba29e48be5162f13ad75308f8358d8878e3 Reviewed-by: Alexey Edelev <alexey.edelev@qt.io> Reviewed-by: Jörg Bornemann <joerg.bornemann@qt.io> (cherry picked from commit 94b158134c8819c74ccddd2c8877a44c12f1c4c9) Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
* CMake: Handle slashes in qt_internal_add_exampleAlexandru Croitor2022-02-101-0/+13
| | | | | | | | | | | | | | | qtdeclarative has a call like qt_internal_add_example(imagine/automotive) This causes issues when trying to pass that as the name of the external project. Use the last part after the last slash as the name of the project. Change-Id: Ifc074e50e537f07f3636699ed255d2561930d873 Reviewed-by: Andrei Golubev <andrei.golubev@qt.io> Reviewed-by: Alexey Edelev <alexey.edelev@qt.io> (cherry picked from commit 92dff7c5f80fbc1e628a278ec4c2b216d24e04bb) Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
* CMake: Temporarily disable building external examples in prefix buildsAlexandru Croitor2022-02-041-1/+9
| | | | | | | | | | | | | | | | | | | | There are issues when building examples as external projects in the CI in child repos like qtsvg. QEMU configurations fail to find some CMake Config files, Windows configs fail to find libraries. Until these issues are fixed, build examples in-tree (without using external projects) like we did before. Temporarily disables 98c89c8cc1c5ceb4bfbb5f5ed6c96ecdbab99afa Task-number: QTBUG-90820 Task-number: QTBUG-96232 Change-Id: Ia4b39812b27cfde5f5a103fd39cc1cb032842643 Reviewed-by: Fabian Kosmale <fabian.kosmale@qt.io> (cherry picked from commit d1c825ae8cf5eca58f99b49913ac106ee9104f9c) Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
* configure: Raise error if -skip/-submodules is used in per-repo buildAlexandru Croitor2022-02-041-0/+10
| | | | | | | | | | Specifying the options would do nothing, so it's better to error out early in case the developer accidentally added them. Change-Id: Ia516468a22c3c48e9e84dc78e522e8870186d96b Reviewed-by: Alexey Edelev <alexey.edelev@qt.io> (cherry picked from commit acaba632605ac22aa3da4c3cf8e5891cb9cde657) Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
* configure: Introduce -submodules optionAlexandru Croitor2022-02-042-0/+6
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | The option is used to specify a list of Qt repos (git submodules) that should be included in the configuration of a top-level Qt build. The option takes a comma-separated list of qt submodule names e.g. 'qtbase,qtsvg,qtdeclarative' It can also take a single value like 'qtbase' or 'qtquick3d'. Each specified submodule and all of its transitive dependencies will be included when configuring the top-level Qt build (assuming that the submodules have previously been already checked out). Any missing submodules or dependencies will not be automatically checked out, but rather skipped. This can result in a failed configuration if a required submodule is missing. If some optional transitive submodule dependency is not desired in the build, you can combine the -submodules option together with -skip options. E.g. configuring with -submodules qtdoc,qtnetworkauth -skip qtmultimedia,qtimageformats will result in a top-level build with the following submodules: - qtbase (common dependency) - qttools (dependency of qtdoc) - qtactiveqt dependency of qttools) - qshadertools (dependency of qtdeclarative) - qtdeclarative (explicit) - qtnetworkauth (explicit) - qtdoc (explicit) Fixes: QTBUG-100388 Change-Id: Ie8c47cfd1d1e0e44a27260bf9ddf968531cc1cc0 Reviewed-by: Alexey Edelev <alexey.edelev@qt.io> Reviewed-by: Volker Hilsheimer <volker.hilsheimer@qt.io> (cherry picked from commit 7cb2bbd9e765bd90a2df06c7256d0306d669fbe6) Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
* configure: Allow specifying a comma separated list to -skip optionAlexandru Croitor2022-02-042-3/+16
| | | | | | | | | | | | | | | | | This makes skipping a list of submodules more concise. e.g. instead of passing -skip qtsvg -skip qtimageformats -skip qtmultimedia pass -skip qtsvg,qtimageformats,qtmultimedia Change-Id: I6a48828b2fd7cec9f6e19988f7b4033333768abb Reviewed-by: Alexey Edelev <alexey.edelev@qt.io> (cherry picked from commit 40155ddd0ebec827b315549c5d528d8d3070f5fb) Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
* Add qt_internal_undefine_global_definition functionAlexey Edelev2022-02-023-17/+23
| | | | | | | | | | | | | | | | | qt_internal_undefine_global_definition disables an internal global definition that is defined by the qt_internal_add_global_definition function for a specific target. Remove the ability to set the custom "undefine" flag for the definitions since it's hard to control it using the introduced function. Task-number: QTBUG-100334 Change-Id: Ic1637d97aa51bbdd06c5b191c57a941aa208d4dc Reviewed-by: Alexandru Croitor <alexandru.croitor@qt.io> Reviewed-by: Qt CI Bot <qt_ci_bot@qt-project.org> (cherry picked from commit fd3341a74ecbe93c5fb931f625075b93be69b9de) Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
* CMake: Allow installing examples outside of the Qt prefixAlexandru Croitor2022-02-022-1/+14
| | | | | | | | | | | | | | | | | | | | Introduce a new QT_INTERNAL_CUSTOM_INSTALL_DIR variable to allow specifying an 'examples install dir' outside of the Qt prefix. It will be used in a follow-up change to ensure we don't package the example binaries in our CI artifacts (thus saving space). This will be even more important when the examples will contain code to deploy Qt libraries alongside each deployed example (which would significantly increase the package size). Task-number: QTBUG-90820 Task-number: QTBUG-96232 Change-Id: I06b4a8f9e8c57a712a356bca0f5c351a9362bc30 Reviewed-by: Jörg Bornemann <joerg.bornemann@qt.io> Reviewed-by: Qt CI Bot <qt_ci_bot@qt-project.org> (cherry picked from commit 1031fa15472bba3f20691cda2305e0821391c5db) Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
* CMake: Build examples as ExternalProjects in prefix buildsAlexandru Croitor2022-02-022-27/+124
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | Change prefix builds to use ExternalProjects to build examples by default. This will affect our CI which only does prefix builds. To make it work, we have to do a few adjustments: - look for Config files in the build-tree (before Qt is installed) - build only one examples with only a single config, even if Qt is a multi-config build - install examples as part of main make install step, rather than as part of the make step (which is the default for EPs) - adjust CXX flags when building with MSVC to ensure we can still use sccache and separate debug info - derive the correct install prefix for each example and pass it to the ExternalProject As a drive-by, add TODOs to address tidiness of the code and corner cases that likely don't work (Conan). Amends d97fd7af2bc5c89a0ad9e5fac080041b78d01179 Task-number: QTBUG-90820 Task-number: QTBUG-96232 Change-Id: I3060da5dc64e7b06052f9dcb720d4d250f876450 Reviewed-by: Qt CI Bot <qt_ci_bot@qt-project.org> Reviewed-by: Jörg Bornemann <joerg.bornemann@qt.io> (cherry picked from commit 98c89c8cc1c5ceb4bfbb5f5ed6c96ecdbab99afa) Reviewed-by: Alexey Edelev <alexey.edelev@qt.io>
* CMake: Deduce install prefix of example in qt_internal_add_exampleAlexandru Croitor2022-02-021-2/+43
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | We want to get rid of the INSTALL_EXAMPLEDIR and INSTALL_EXAMPLESDIR code in each example project. This was an internal workaround to ensure examples are installed into a relative path somewhere under $qt_prefix/examples and not in $qt_prefix/bin or similar. To achieve that we do two things. First, deduce the install prefix for each example in the implementation of qt_internal_add_example (our add_subdirectory wrapper) and assign it to CMAKE_INSTALL_PREFIX before calling add_subdirectory. We need to make sure to remove the default value of CMAKE_INSTALL_PREFIX in the generated cmake_install.cmake file. Second, we set an internal variable called QT_INTERNAL_SET_EXAMPLE_INSTALL_DIR_TO_DOT before the add_subdirectory call, which will be checked whenever find_package(Qt6Core) is called in an example project. If the variable is set, the INSTALL_EXAMPLEDIR var is set to "." in the scope of where Qt6Core is found. This ensures that the hardcoded INSTALL_EXAMPLEDIR values in our example projects are changed to ".". With both changes, our example project install(TARGET DESTINATION) calls will now install to "${CMAKE_INSTALL_PREFIX}/examples/${example_relative_dir}/." Once all repositories are updated to use qt_internal_add_example instead of add_subdirectory, we can get rid of the QT_INTERNAL_SET_EXAMPLE_INSTALL_DIR_TO_DOT workaround. For repositories that still don't use qt_internal_add_example, the install prefix rewriting will not happen, but the examples will still be installed to the proper place because they use their own hardcoded INSTALL_EXAMPLEDIR value. Amends d97fd7af2bc5c89a0ad9e5fac080041b78d01179 Task-number: QTBUG-96232 Task-number: QTBUG-98545 Change-Id: I78c118e10c41b519c570c7d87529afd15aeed900 Reviewed-by: Jörg Bornemann <joerg.bornemann@qt.io> (cherry picked from commit ac4a913f333561803003650817de453f43be924d) Reviewed-by: Alexey Edelev <alexey.edelev@qt.io>
* CMake: Copy FindFoo.cmake scripts to build dir in prefix buildsAlexandru Croitor2022-02-011-0/+11
| | | | | | | | | | | | | | | They are used by build dir Qt6FooConfig.cmake files in conjunction with export(EXPORT)'ed target files when building ExternalProjects against a non-installed Qt (or in a top-level build). Change-Id: I688caf1bd1b8a8fe7e549cebade2aef6f928bd6c Task-number: QTBUG-90820 Task-number: QTBUG-96232 Reviewed-by: Jörg Bornemann <joerg.bornemann@qt.io> Reviewed-by: Qt CI Bot <qt_ci_bot@qt-project.org> Reviewed-by: Alexey Edelev <alexey.edelev@qt.io> (cherry picked from commit 1273ffb0002b14d952807c250dbcc6228f60ff26) Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
* CMake: Split qt_internal_add_example into two functionsAlexandru Croitor2022-02-011-5/+12
| | | | | | | | | | | | One for building using ExternalProject_Add and one when examples are built in-tree by calling add_subdirectory directly. Change-Id: If4c5301163aefed9f15148a70a8f7014bc817ac0 Reviewed-by: Jörg Bornemann <joerg.bornemann@qt.io> Reviewed-by: Qt CI Bot <qt_ci_bot@qt-project.org> Reviewed-by: Alexey Edelev <alexey.edelev@qt.io> (cherry picked from commit 209438c16ab6904efeda936ceefcc0ae7d14d85f) Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
* CMake: Shorten ExternalProject example project pathsAlexandru Croitor2022-02-011-3/+15
| | | | | | | | | | | | | | | | | | | | | | | | Instead of nesting the external project build dir under the current binary dir, place the EP build dir where it would usually be when we use add_subdirectory. Shorten the name of the external project to just ${subdir} instead of using the relative current binary dir path. Place the EP prefix and stamp dirs under a new ${subdir}-ep folder next to the example build dir. Overall this places example executables where you'd usually expect them to be, as well as shortens a bunch of build paths to circumvent path limit issues when building on Windows. Fixes: QTBUG-94608 Task-number: QTBUG-96232 Change-Id: Ifb921c5a6397385e8a914111bf56ee59cda003fd Reviewed-by: Jörg Bornemann <joerg.bornemann@qt.io> Reviewed-by: Alexey Edelev <alexey.edelev@qt.io> (cherry picked from commit 1a103beff61542c5149c3876a7bb0885ec989c0a) Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
* CMake: Run export(EXPORT) for prefixed and top-level buildsAllan Sandfeld Jensen2022-02-011-7/+11
| | | | | | | | | | | | | | | | This is necessary to be able to find Qt6 modules in CMake ExternalProjects before Qt is installed, regardless of top-level or per-repo builds. One use case is examples that are built as ExternalProjects. Task-number: QTBUG-90820 Task-number: QTBUG-96232 Change-Id: Ic6a9bfd1c52a04e34b221deab40f419a6fee9463 Reviewed-by: Allan Sandfeld Jensen <allan.jensen@qt.io> Reviewed-by: Qt CI Bot <qt_ci_bot@qt-project.org> Reviewed-by: Jörg Bornemann <joerg.bornemann@qt.io> (cherry picked from commit b954a79e25f15bbce499afaa4304e7ab71648cd5) Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
* Enable -bigobj by default for QtAlexey Edelev2022-02-011-1/+8
| | | | | | | | | | | Add '-bigobj' for MSVC and '-Wa,-mbig-obj' for MINGW to the PlatformCommonInternal compiler options. Fixes: QTBUG-100365 Change-Id: I706b83d189a116a3ab6f93d59593e237e66b0e2e Reviewed-by: Thiago Macieira <thiago.macieira@intel.com> (cherry picked from commit 28da24a1a64fc901b858b586d4ce90bdca20d153) Reviewed-by: Fabian Kosmale <fabian.kosmale@qt.io>
* Restore missing Qt definitionsAlexey Edelev2022-02-012-0/+76
| | | | | | | | | | | | | | | | | | Restore the 'QT_NO_JAVA_STYLE_ITERATORS' and 'QT_NO_NARROWING_CONVERSIONS_IN_CONNECT' definitions for Qt targets. Add the function that adds global definitions for Qt targets according to the provided scope and the target property-based switch to disable the definition for a specific target. Task-number: QTBUG-100295 Change-Id: I28697e81f9aabc45c48d79aae1e5caea141e04e1 Reviewed-by: Qt CI Bot <qt_ci_bot@qt-project.org> Reviewed-by: Marc Mutz <marc.mutz@qt.io> Reviewed-by: Alexandru Croitor <alexandru.croitor@qt.io> (cherry picked from commit 1d28fd7a9c4720289f3d41db2ed8e6fcb07d5a30) Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
* CMake: fix running of headersclean targets when CMAKE_CXX_FLAGS is setThiago Macieira2022-02-011-1/+1
| | | | | | | | | | | | | | | We were passing the full option from the user as a single string in the command-line to the compiler. clang++ -c "-O3 -g1 -march=tigerlake -mprefer-vector-width=256 -maes" [...] error: invalid integral value '3 -g1 -march=tigerlake -mprefer-vector-width=256 -maes' in '-O3 -g1 -march=tigerlake -mprefer-vector-width=256 -maes' Fixes: QTBUG-100315 Change-Id: I6fcda969a9e9427198bffffd16ce83150d4e4263 Reviewed-by: Qt CI Bot <qt_ci_bot@qt-project.org> Reviewed-by: Alexandru Croitor <alexandru.croitor@qt.io> (cherry picked from commit 05e029619f18e66d587075e929bc2d8c384f367a) Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
* Fix finding GSSAPIAllan Sandfeld Jensen2022-01-301-2/+5
| | | | | | | | | | The package is called mit-krb5-gssapi on Ubuntu, and the LIBDIR variable was missing an underscore. Change-Id: I85b5603c1161f33462aa71bbd522d40dd7489405 Reviewed-by: Alexandru Croitor <alexandru.croitor@qt.io> (cherry picked from commit 7e591453be37caf4d8e2bcb7ebc6b706b84f50be) Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
* CMake: Fix host UiTools being picked up instead of target oneAlexandru Croitor2022-01-281-0/+1
| | | | | | | | Fixes: QTBUG-100233 Change-Id: Id4b30841ba9e499f462325f882218edf407e0a00 Reviewed-by: Jörg Bornemann <joerg.bornemann@qt.io> (cherry picked from commit c8621da85265ecec8968eb54bfaa1558474f241b) Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
* CMake: Support overriding CMAKE_BUILD_TYPE per-repo or testJoerg Bornemann2022-01-213-7/+53
| | | | | | | | | | | | | | | | | | | | | | One might want to build qtbase in Release, but qtsvg or some test in Debug mode. Before if qtbase was configured as Release, there was no way to override that. Now we try to detect whether a custom build type was specified to qt-cmake / qt-configure-module / qt-cmake-standalone-test / qt-internal-configure-tests Note mixing won't work on Windows due to different C/C++ runtimes. Also, now we don't force set a single build type when a multi config generator is used as well as one opts out via the QT_NO_FORCE_SET_CMAKE_BUILD_TYPE variable. Change-Id: I6dc4325087ff7f905ad677d87b0267e2f3e4693f Reviewed-by: Qt CI Bot <qt_ci_bot@qt-project.org> Reviewed-by: Joerg Bornemann <joerg.bornemann@qt.io> (cherry picked from commit 33af62db3747bb6fcb7490ef2d2abc5bb53925b6) Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
* CMake: Display CMAKE_BUILD_TYPE when including QtSetupAlexandru Croitor2022-01-211-0/+2
| | | | | | | | | | | This will show the CMAKE_BUILD_TYPE that was computed for a configured repo or standalone tests, after the logic in QtBuildInternalsExtra.cmake is executed. Change-Id: Ib8ffa2c7806a4c16385a2fcd4500f8a0f6a9aa88 Reviewed-by: Joerg Bornemann <joerg.bornemann@qt.io> (cherry picked from commit 0d5dc56554988edb87cb1575220a107c8a1f9cc4) Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
* CMake: Add support building Qt with the 'mold' linkerAlexandru Croitor2022-01-201-0/+59
| | | | | | | | | | | | | | | | | | | | | | | | | The mold linker is a new linker for Linux that provides faster link times compared to BFD ld, ld.gold and lld. It can be found at https://github.com/rui314/mold To build Qt with mold, ensure that the binary in your PATH and then configure Qt with with either cmake /path/to/qtbase -DINPUT_linker=mold or /path/to/qtbase/configure --linker mold The change was tested with gcc 9, clang 10, clang 12, mold 1.0.0. Only qtbase and qtdeclarative (and dependencies) were tested. Task-number: QTBUG-99270 Change-Id: I2e64a1f4257c37ff5b64a9326e548b9b46e07c80 Reviewed-by: Fabian Kosmale <fabian.kosmale@qt.io> (cherry picked from commit 158287c726b9ee7031c6e832dc159d02473e34d7) Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
* CMake: Fix qt_run_linker_version_script_support to use active linkerAlexandru Croitor2022-01-192-1/+12
| | | | | | | | | | | | | | | | The version script compile test did not use the linker that the build system determined to use to link Qt, but rather the system linker. Run qt_run_linker_version_script_support only after the global qtbase features have been evaluated and make sure to include the active linker flags. Change-Id: I0ff82406828daaf0dc5ec25a55f53ac7d98e3347 Reviewed-by: Joerg Bornemann <joerg.bornemann@qt.io> Reviewed-by: Qt CI Bot <qt_ci_bot@qt-project.org> Reviewed-by: Alexey Edelev <alexey.edelev@qt.io> (cherry picked from commit 9198a9b8cc8df04ad130410a9c9f32de2b7b2335) Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
* CMake: Fix detection of linker availabilityAlexandru Croitor2022-01-193-16/+36
| | | | | | | | | | | | | | | | | | | | Previously we passed flags like -ld-fuse=lld only to compile calls, but not to the link call of a compile test project. Make sure to pass it to the link call instead by using check_cxx_source_compiles + CMAKE_REQUIRED_LINK_OPTIONS instead of check_cxx_compiler_flag. Note the flag that is passed is still via passed via the compiler launcher and not directly to the linker. Remove duplicate flag handling code. Change-Id: I1bf90573904a9df83240b6debfee3cc9e425c6bb Reviewed-by: Qt CI Bot <qt_ci_bot@qt-project.org> Reviewed-by: Joerg Bornemann <joerg.bornemann@qt.io> (cherry picked from commit d6066d53fa70e1736ca64d468605a4a430644400)
* Don't repeat conditions of use_*_linker features in QtFeature.cmakeJoerg Bornemann2022-01-191-9/+3
| | | | | | | | | | | | | | | | qt_config_linker_supports() repeated the conditions of all use_*_linker features, because the features are not evaluated yet when this function is called, and the function needs to know what linker is used to build Qt. Move the required tests and features before any qt_config_linker_supports() call and evaluate the use_*_linker features early. Change-Id: I306f032356682a0e82e4d7c4234e5bbc820ab143 Reviewed-by: Qt CI Bot <qt_ci_bot@qt-project.org> Reviewed-by: Alexandru Croitor <alexandru.croitor@qt.io> (cherry picked from commit 564f07086cfeb1ec8065874b4a46a5c5ab904a31) Reviewed-by: Joerg Bornemann <joerg.bornemann@qt.io>
* Clang: don't error out on -Wdeprecated-enum-enum-conversionMarc Mutz2022-01-181-0/+4
| | | | | | | | | Same treatment as is given to GCC further below. Change-Id: I3762c39a0b5d9add365ecf828b80d3ba432578c2 Reviewed-by: Fabian Kosmale <fabian.kosmale@qt.io> (cherry picked from commit 208cfad9adbea950c6bf9dc2fbc190cfb7e07e20) Reviewed-by: Qt CI Bot <qt_ci_bot@qt-project.org>
* CMake: Fix dbus headers not being added in qt_internal_extend_targetAlexandru Croitor2022-01-181-2/+2
| | | | | | | | | | | The generated dbus headers would not appear in IDE source lists because of incorrectly named variables. Change-Id: I276d4284eb94b98cc75f791de62ca332ad947004 Reviewed-by: Qt CI Bot <qt_ci_bot@qt-project.org> Reviewed-by: Alexey Edelev <alexey.edelev@qt.io> (cherry picked from commit 461f68c5c9a4feadc9805fa0c1efc79010364770) Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
* CMake: Propagate qtbase's CMAKE_STAGING_PREFIX to Qt modulesJoerg Bornemann2022-01-172-12/+9
| | | | | | | | | | | | | | | | | | | | | | | | When qtbase is configured with CMAKE_STAGING_PREFIX set, then Qt modules built against this qtbase should also get CMAKE_STAGING_PREFIX by default. Like CMAKE_INSTALL_PREFIX in regular builds, this prefix will be determined by the location of QtBuildInternalsExtra.cmake to support building Qt modules against an installer-provided Qt. CMAKE_INSTALL_PREFIX on the other hand must be exactly the value that was provided when building qtbase. If CMAKE_STAGING_PREFIX is specified by the user, honor it. To opt out of automatically setting CMAKE_STAGING_PREFIX, set QT_BUILD_INTERNALS_NO_FORCE_SET_STAGING_PREFIX to ON. Remove the old code that was supposed to set CMAKE_STAGING_PREFIX. Fixes: QTBUG-99666 Change-Id: I20edef54c102ca9784fcdef0decf0bd83266ae11 Reviewed-by: Alexandru Croitor <alexandru.croitor@qt.io> (cherry picked from commit 037fd545c485e73ac68377a264c84208592dc74f) Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
* CMake: Fix WrapOpenSSL packageJoerg Bornemann2022-01-071-1/+1
| | | | | | | | | | | | | | | | | | | | | | | | | Since f19ce3898e0257dac1112754b1a84c24486bda01 we link OpenSSL to QTlsBackendOpenSSLPlugin instead of QtNetwork itself. In dependent Qt repositories this leads to the following situation: QTlsBackendOpenSSLPlugin's dependencies call find_dependency(WrapOpenSSLHeaders), and OpenSSL_FOUND is set to ON in that scope. Later, we call find_package(WrapOpenSSL) in a different scope. find_package(WrapOpenSSLHeaders) bails out early, because the target WrapOpenSSLHeaders::WrapOpenSSLHeaders exists. find_package(OpenSSL) is not called again. The check for OpenSSL_FOUND fails, because the variable is not visible in the scope of FindWrapOpenSSL.cmake, and we don't create the WrapOpenSSL::WrapOpenSSL target. Fix this by checking for the existence of the target OpenSSL::SSL instead of the OpenSSL_FOUND variable. Fixes: QTBUG-99623 Change-Id: Idd0e8a60fabd0c7772413d557442c0012b0b436c Reviewed-by: Alexey Edelev <alexey.edelev@qt.io> (cherry picked from commit faa26be44cd7306c8ec2276131414866d3de712d) Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
* Update copyright year to 2022Kai Köhne2022-01-051-1/+1
| | | | | | | | Change-Id: If6f1d6f9f82a601f8e2b6d36650d6e737518aa60 Reviewed-by: Paul Wicking <paul.wicking@qt.io> Reviewed-by: Topi Reiniö <topi.reinio@qt.io> (cherry picked from commit 6205cb161d393f96c670d57bca29fed2dcfda14c) Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
* Exclude sources from HEADER_MODULE if cmake version is less than 3.19Alexey Edelev2022-01-041-3/+12
| | | | | | | | | | | | | CMake versions less than 3.19 don't support adding the source files to the PRIVATE scope of the INTERFACE libraries. It looks like these PRIVATE sources are only used by IDEs to display them in a project tree. Skip them to avoid configuring issues. Fixes: QTBUG-99316 Change-Id: Id03f540ac9c94e920adfae5de4f364bd7aba4613 Reviewed-by: Andrei Golubev <andrei.golubev@qt.io> Reviewed-by: Joerg Bornemann <joerg.bornemann@qt.io> (cherry picked from commit 8e2f101a6bf6c59e707b2747d6df76e8e221e319)
* CMake: Fix exit code to be shown properly on test failureAlexandru Croitor2021-12-171-1/+1
| | | | | | | | | | | | | | | | | | | | | The result variable was expanded at configure time rather than at script execution time due to missing escaping. A tidbit of information, the result variable can contain not only an exit code, but a string as well. For example on arm macOS with a crashed test it contains 'SIGTRAP'. Curiously if the crashing executable is executed directly without CMake, 'Trace/BPT trap: 5' is shown instead, perhaps because of the shell. Amends 3ef6af024be43bc18352796df61542a241192583 Change-Id: I50e57922abfc6eccde205c6252eebfda510bad41 Reviewed-by: Fabian Kosmale <fabian.kosmale@qt.io> (cherry picked from commit 340b2a1a47244cba064c17b69782236c0d7e16e5) Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
* QtTestHelpers: print exit code upon failureFabian Kosmale2021-12-171-1/+1
| | | | | | | | | | This might give a few insights into why the process has failed, at least if distinct return values are used for different errors. Change-Id: I61fe0ede812c4dda3d0cf0f2c96a479d198d340d Reviewed-by: Kai Koehne <kai.koehne@qt.io> (cherry picked from commit 3ef6af024be43bc18352796df61542a241192583) Reviewed-by: Fabian Kosmale <fabian.kosmale@qt.io>
* CMake: Fix errors about missing qt_setup_tool_path_command.bat.inJoerg Bornemann2021-12-162-6/+3
| | | | | | | | | | | | | | | | | | This amends commit 0bea727cac6b22af05e0ae68b02de6684c98667b or rather reverts it and applies a different fix for QTBUG-98843. Use file(WRITE) instead of configure_file or file(CONFIGURE). This command doesn't have the line endings issues in CMake 3.19 (see QTBUG-98843). It's not problematic that the .bat file gets a new timestamp on every configuration step, since we don't add dependencies on it. Fixes: QTBUG-99223 Task-number: QTBUG-98843 Change-Id: Ibdcd0e4703bf6df42c6a6d0bb2f35c5144bbe30a Reviewed-by: Alexey Edelev <alexey.edelev@qt.io> (cherry picked from commit 2a013fec1ccd5b262f0da29b3aa45771fd966294) Reviewed-by: Kai Koehne <kai.koehne@qt.io>
* Use the highest-available android SDK version as the 'target' SDKAlexey Edelev2021-12-141-15/+26
| | | | | | | | | | | | | When building Qt we want to use the highest available 'target' SDK version. If the version of the available SDK is lower than the minimum required 'target' SDK version, we need to throw an error. Fixes: QTBUG-99165 Task-number: QTBUG-98870 Change-Id: Ib75567a6f33ac6d23d9f79e8ed8535839c08b91d Reviewed-by: Joerg Bornemann <joerg.bornemann@qt.io> (cherry picked from commit 2f30e9d75195e01024df5df2ccdca4067fd448d5) Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
* CMake: Be precise about EXTERNAL_BUILD check when building examplesAlexandru Croitor2021-12-141-1/+3
| | | | | | | | | | | | | | | | | | This change allows temporarily removing the EXTERNAL_BUILD option in a qt repo examples project to check how the examples behave in a non-external project build, without forcing the developer to use a prefix build. Useful to compare behavior until we've ported over prefix builds to use EXTERNAL_BUILD. Amends d97fd7af2bc5c89a0ad9e5fac080041b78d01179 Change-Id: I29b834bb5f00e1e93966caae6f816faedba76b76 Reviewed-by: Craig Scott <craig.scott@qt.io> Reviewed-by: Joerg Bornemann <joerg.bornemann@qt.io> (cherry picked from commit dab8f64b6d5d4241b678d0227355858071376496) Reviewed-by: Alexey Edelev <alexey.edelev@qt.io>
* CMake: Fix build on Windows with CMake 3.19Joerg Bornemann2021-12-132-10/+6
| | | | | | | | | | | | | | | | | qt_setup_tool_path.bat did not have proper line endings on Windows with CMake 3.19, breaking the invocation of tools that use the wrapper, for example qmltyperegistrar. The reason was that file(CONFIGURE) doesn't properly write line endings with CMake 3.19. See upstream issue #21769. Use configure_file with a proper input file to work around this issue. Fixes: QTBUG-98843 Change-Id: I2a4da15f306dc844cf83ca9721a77196c42af2ad Reviewed-by: Alexandru Croitor <alexandru.croitor@qt.io> (cherry picked from commit 0bea727cac6b22af05e0ae68b02de6684c98667b) Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
* Install MSVC debug information for resource object librariesJoerg Bornemann2021-12-112-1/+32
| | | | | | | | | | | | | | | | | Building against a static debug MSVC Qt produced LNK4099 warnings (PDB was not found with object file). This was because we did not install the .pdb files for the object libraries that are created for Qt resources. Now, these .pdb files are named like the object library targets and are installed next to the object files. Fixes: QTBUG-97699 Change-Id: I7e23f8392b7ac657be1d2fb3b33e051ae2e4d407 Reviewed-by: Alexandru Croitor <alexandru.croitor@qt.io> Reviewed-by: Qt CI Bot <qt_ci_bot@qt-project.org> (cherry picked from commit 75eb08711ef7a51305b4daad411548a2b6b4f8c6) Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
* CMake: Fix Android platform detectionJoerg Bornemann2021-12-081-1/+28
| | | | | | | | | | | | | | | | ...if an Android platform < 10 is installed. The existing platform detection code preferred android-9 over android-31, because the sorting did not use natural comparison. Natural comparison was added to CMake in version 3.18. We simulate this feature for older CMake versions. Fixes: QTBUG-98726 Change-Id: Ib2eb87bd47220feb672275fa5203df4f2b6d7ca7 Reviewed-by: Alexandru Croitor <alexandru.croitor@qt.io> (cherry picked from commit 95ccdfa43276652f1b9ca5944a94b7e15c510dbd) Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
* Add missing dependency of ${target}_check to ${target}_make_apkAlexey Edelev2021-11-261-0/+3
| | | | | | | | | | | When building for and running the '_check' target in Android we need to make sure that target apk is assembled and ready for deployment. Change-Id: Ifc63aac230f0bb8375d319ec443174c5a436485e Reviewed-by: Volker Hilsheimer <volker.hilsheimer@qt.io> Reviewed-by: Alexandru Croitor <alexandru.croitor@qt.io> (cherry picked from commit aba1432daee254b7db544e61d9f5ec6b42670d9a) Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>