summaryrefslogtreecommitdiffstats
path: root/cmake/QtCMakeHelpers.cmake
Commit message (Collapse)AuthorAgeFilesLines
* CMake: Allow disabling package version checkAlexandru Croitor2021-10-271-0/+22
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | When building Qt repos, all find_package(Qt6) calls request a PROJECT_VERSION version which is set in .cmake.conf via QT_REPO_MODULE_VERSION. This means trying to configure qtsvg from a 6.3 branch using a 6.2 qtbase won't work, because qtsvg will call find_package(Qt6 6.3) and no such Qt6 package version exists. There are certain scenarios where it might be useful to try to do that though. One of them is doing Qt development while locally mixing branches. Another is building a 6.4 QtWebEngine against a 6.2 Qt. Allow to opt out of the version check by configuring each Qt repo with -DQT_NO_PACKAGE_VERSION_CHECK=TRUE. This setting is not recorded and will have to be set again when configuring another repo. The version check will also be disabled by default when configuring with the -developer-build feature. This will be recorded and embedded into each ConfigVersion file. If the version check is disabled, a warning will be shown mentioning the incompatible version of a package that was found but that package will still be accepted. The warning will show both when building Qt or using Qt in a user project. The warnings can be disabled by passing -DQT_NO_PACKAGE_VERSION_INCOMPATIBLE_WARNING=TRUE Furthermore when building a Qt repo, another warning will show when an incompatible package version is detected, to suggest to the Qt builder whether they want to use the incompatible version by disabling the version check. Note that there are no compatibility promises when using mixed non-matching versions. Things might not work. These options are only provided for convenience and their users know what they are doing. Pick-to: 6.2 Fixes: QTBUG-96458 Change-Id: I1a42e0b2a00b73513d776d89a76102ffd9136422 Reviewed-by: Craig Scott <craig.scott@qt.io>
* CMake: Pass Qt6_FIND_VERSION in Qt6Config when looking for componentsAlexandru Croitor2021-08-191-2/+2
| | | | | | | | | | | | | | | | | | | | | | | 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. Pick-to: 6.2 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>
* 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. Pick-to: 6.1 6.2 Change-Id: I70c26dc91394f4a14f7a26419df264a069dc7dc5 Reviewed-by: Kai Koehne <kai.koehne@qt.io> Reviewed-by: Craig Scott <craig.scott@qt.io>
* Add a way to install versioned hard-links for toolsJoerg Bornemann2021-03-251-0/+20
| | | | | | | | | | | | | | | | | Add the option argument INSTALL_VERSIONED_LINK to qt_internal_add_tool and qt_internal_add_app. For tools/apps with this argument we create an install rule that creates a versioned hard link. For example, for bin/qmake we create bin/qmake6. Note that this only applies to prefix builds. Apply this argument to qmake. The qt_internal_add_app change is necessary for qtdiag and in qttools. Task-number: QTBUG-89170 Change-Id: Id32d6055544c475166f4d854aaeb6292fbb5fbb5 Reviewed-by: Alexandru Croitor <alexandru.croitor@qt.io> (cherry picked from commit c19d957f45fa27f61b5ecc566f8dbc19f12a44c3)
* CMake: Prevent qt_remove_args() from accessing out-of-range list indexCraig Scott2021-02-241-0/+4
| | | | | | Pick-to: 6.1 Change-Id: Ie9c5f0551722c7d3fb11879b209c11ce3d7ccd6d Reviewed-by: Kai Koehne <kai.koehne@qt.io>
* cmake: Add function to get a target property, with empty string as fallbackTor Arne Vestbø2020-11-081-0/+9
| | | | | Change-Id: Ic39fefb91e9ca0f36c815c969ff1072767a9ab16 Reviewed-by: Alexandru Croitor <alexandru.croitor@qt.io>
* CMake: Do not overrun the list end in qt_remove_argsUlf Hermann2020-10-271-2/+4
| | | | | | | | Otherwise we get error messages from CMake. Change-Id: I374b87e38550062b841b7eacf5fbb6bb5ccbdbde Reviewed-by: Fabian Kosmale <fabian.kosmale@qt.io> Reviewed-by: Alexandru Croitor <alexandru.croitor@qt.io>
* CMake: Split QtBuild.cmake into smaller filesAlexandru Croitor2020-08-141-0/+151
QtBuild.cmake is huge. Split it. Move module, plugin, tools, executables and test related functions out of QtBuild.cmake into separate files. Do the same for many other things too. An additional requirement is that all the new Helpers files only define functions and macros. No global variable definitions are allowed, nor execution of commands with side effects. Some notes: qt_install_qml_files is removed because it's dead code. Some functions still need to be figured out, because they are interspersed and depend on various global state assignments. Task-number: QTBUG-86035 Change-Id: I21d79ff02eef923c202eb1000422888727cb0e2c Reviewed-by: Joerg Bornemann <joerg.bornemann@qt.io>