summaryrefslogtreecommitdiffstats
path: root/cmake
Commit message (Collapse)AuthorAgeFilesLines
* CMake: Implement configure -gdb-indexJoerg Bornemann2020-08-232-1/+5
| | | | | Change-Id: Iea0fb99297751b1baf830a416ea5041d0b9a3b63 Reviewed-by: Alexandru Croitor <alexandru.croitor@qt.io>
* CMake: Actually evaluate AUTODETECT expressions in featuresJoerg Bornemann2020-08-231-1/+2
| | | | | | | | Very simple AUTODETECT expressions worked fine, but expressions with parentheses, for example, were not correctly evaluated. Change-Id: Ibec4fa55474e149a701f861838fdea41d31beca0 Reviewed-by: Alexandru Croitor <alexandru.croitor@qt.io>
* CMake: Support configure tests of type 'linkerSupportsFlag'Joerg Bornemann2020-08-232-0/+29
| | | | | | Task-number: QTBUG-86155 Change-Id: I3764d99cd4ad1c432b499ec9ba7c4c48391fa421 Reviewed-by: Alexandru Croitor <alexandru.croitor@qt.io>
* CMake: Implement configure -optimize-sizeJoerg Bornemann2020-08-232-1/+6
| | | | | | | | | | | | This configure switch controls the feature 'optimize_size'. This isn't merely a mapping to CMAKE_BUILD_TYPE=MinSizeRel, because we potentially want to combine -optimize-size with -force-debug-info, which maps to CMAKE_BUILD_CONFIG=RelWithDebInfo. Task-number: QTBUG-85373 Change-Id: I1a9343ebc54816f52e90e9d33ea3df4c99b1ec9f Reviewed-by: Alexandru Croitor <alexandru.croitor@qt.io>
* CMake: Fix configure setting superfluous featuresJoerg Bornemann2020-08-231-5/+7
| | | | | | | | | | | | | Command line options like -debug result in setting the variable INPUT_debug. INPUT_debug is mapped to the CMake argument -DCMAKE_BUILD_TYPE=Debug. INPUT_debug also matches the feature 'debug', and the CMake argument -DFEATURE_debug=ON was passed. Do not pass -DFEATURE_xxx CMake arguments for inputs that are already handled. Change-Id: If096dff1c6dd694545c6f671f5f3512a43c3ec50 Reviewed-by: Alexandru Croitor <alexandru.croitor@qt.io>
* CMake: Document more configure argument mappingsJoerg Bornemann2020-08-231-3/+3
| | | | | Change-Id: Icda71c14cde638e874cc2e6406527b9c98535165 Reviewed-by: Alexandru Croitor <alexandru.croitor@qt.io>
* CMake: Fix creation of host-qmake wrapper when cross-compilingAlexandru Croitor2020-08-231-1/+2
| | | | | | | | | The -host prefix was added to the 'preliminary' directory rather than the actual wrapper shell script. This caused it to be overwritten every time by the cross-compiled qmake binary. Change-Id: I103811c6aa9181fa701e3e7ecaf828ecdd1e3c90 Reviewed-by: Joerg Bornemann <joerg.bornemann@qt.io>
* CMake: Implement configure -optimize-debugJoerg Bornemann2020-08-202-1/+8
| | | | | | Task-number: QTBUG-85373 Change-Id: I3aba1fcf96e36544dd75a5e6adc5f770a9a45726 Reviewed-by: Alexandru Croitor <alexandru.croitor@qt.io>
* CMake: Implement configure -linker [bfd,gold,lld]Joerg Bornemann2020-08-202-1/+10
| | | | | | Fixes: QTBUG-86155 Change-Id: I5ba2d3b52d9ca240b48904c492f7902a056c0292 Reviewed-by: Alexandru Croitor <alexandru.croitor@qt.io>
* CMake: Support configure tests of type 'compilerSupportsFlag'Joerg Bornemann2020-08-202-0/+12
| | | | | | Task-number: QTBUG-86155 Change-Id: Iaa5c48b6508870a0f6afdf9df66cd2e634fe19b3 Reviewed-by: Alexandru Croitor <alexandru.croitor@qt.io>
* CMake Build: Use EGL library as dependency for GLESv2Cristian Adam2020-08-201-0/+8
| | | | | | | | | | | | | On QNX the feature detection of GLESv2 is failing due to missing symbols which are part of EGL library. Add EGL library as a dependency if it's found on the system. This allows OpenGL ES feature detection to work on QNX. Task-number: QTBUG-83202 Change-Id: I90531d925fadce5d893ea9244793fc02a4595ed1 Reviewed-by: Alexandru Croitor <alexandru.croitor@qt.io>
* CMake Build: Add QNX 7.1 build supportCristian Adam2020-08-201-0/+15
| | | | | | | | | | | | | | | | | | | | | | | | This commit allows building Qt6's QtBase using QNX 7.1 and a toolchain file which is almost identical to what CMake has in its documentation: https://cmake.org/cmake/help/latest/manual/cmake-toolchains.7.html#cross-compiling-for-qnx set(CMAKE_SYSTEM_NAME QNX) set(arch gcc_ntoarmv7le) set(CMAKE_C_COMPILER qcc) set(CMAKE_C_COMPILER_TARGET ${arch}) set(CMAKE_CXX_COMPILER q++) set(CMAKE_CXX_COMPILER_TARGET ${arch}) set(CMAKE_SYSROOT $ENV{QNX_TARGET}) The only difference is the usage of q++ instead of QCC, which is no longer present in QNX 7.1 SDK. Task-number: QTBUG-83202 Change-Id: I51031540721275f2ee83cee9e7df4994a65db0e2 Reviewed-by: Alexandru Croitor <alexandru.croitor@qt.io>
* CMake Build: Fix libdrm detection and compilation on QNXCristian Adam2020-08-191-7/+9
| | | | | | | | | | | | On QNX 7.1 x86drm.h is located under <...>/usr/include/libdrm, unlike linux where it's present under /usr/include. find_path would not find it on QNX, and instead get /usr/include from host, which resulted in a failure to compile. Task-number: QTBUG-83202 Change-Id: I03d6c2d4dfbe91bb70df0a322e84890bd7c8548a Reviewed-by: Alexandru Croitor <alexandru.croitor@qt.io>
* CMake: Add /OPT:REF flag when building Qt on WindowsAlexandru Croitor2020-08-191-0/+7
| | | | | | | | | | | | In qmake it's done for all qmake projects, in CMake we lean on the safe side and apply it to building Qt itself. User CMake projects can then choose to add it themselves. Task-number: QTBUG-85992 Change-Id: I51919f947d43ffd9925e3d2837dcad17e480367d Reviewed-by: Cristian Adam <cristian.adam@qt.io> Reviewed-by: Joerg Bornemann <joerg.bornemann@qt.io> Reviewed-by: Qt CI Bot <qt_ci_bot@qt-project.org>
* CMake: Adjust compiler flag optimizations to qmake mkspec onesAlexandru Croitor2020-08-193-0/+216
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | There are inconsistencies in the default optimization flags added by CMake across configurations like Release and RelWithDebInfo. In particular Release uses -O3, whereas RelWithDebInfo uses -O2, as well as usage of /INCREMENTAL in release configs with MSVC, etc. To make sure that the Qt 6 binaries built with CMake are consistent across configs, as well as consistent with the flags we used when building Qt 5 with qmake, add a horrible search and replace mechanism to replaces the CMake flags with what our mkspecs indicate to use. Ideally this would be done by providing custom CMake toolchain files for each platform we support, and we might revisit that later if the need really arises. To implement the replacing, we first need the flags that should be added. Port the QMAKE_CFLAGS_OPTIMIZE variables to CMake, which is done in QtCompilerOptimization.cmake. Then a new function called qt_internal_set_up_config_optimizations_like_in_qmake will look for any kind of optimization flags set in the CMAKE_<LANG>_FLAGS_<CONFIG> style variables, remove them, and add the appropriate flags that qmake mkspecs provide. On some platforms (like Windows MSVC) the function also alters the linker CMAKE_${TYPE}_LINKER_FLAGS_<CONFIG> style variables. The mechanism allows opting out of this replacing by setting the QT_USE_DEFAULT_CMAKE_OPTIMIZATION_FLAGS value. It also allows opting into removal of flags for custom configs by providing QT_ADDITIONAL_OPTIMIZATION_FLAG_CONFIGS. It's only removal, because we wouldn't know what kind of config it is, and thus what flags to add. The currently modified configs are: Release, RelWithDebInfo, MinSizeRel, Debug aka the usual default CMake provided ones. The mechanism is only applied to C-like languages. ASM is not handled to be on the safe side due to not knowing what kind of compiler flags the platform assembler might take. It's also important to skip RC on MSVC platforms. Task-number: QTBUG-85992 Change-Id: I3712d5cd5a34fceab54f56a6fa46b4e678952362 Reviewed-by: Qt CI Bot <qt_ci_bot@qt-project.org> Reviewed-by: Cristian Adam <cristian.adam@qt.io>
* CMake Build: Add include guards for FindPPS.cmake and FindSlog2.cmakeCristian Adam2020-08-192-0/+8
| | | | | | | | | The CMake configure process fails without include guards for these two find modules on QNX. Task-number: QTBUG-83202 Change-Id: I3cc589f98bc3b6b22c401421927ee6dab2663fb7 Reviewed-by: Alexandru Croitor <alexandru.croitor@qt.io>
* CMake Build: Disable pkg-config for QNXCristian Adam2020-08-191-1/+1
| | | | | | | | QNX doesn't come with pkg-config support. Task-number: QTBUG-83202 Change-Id: I2ac0c014a071b83ef9a2d8114bae0e9ff9b3b422 Reviewed-by: Alexandru Croitor <alexandru.croitor@qt.io>
* CMake Port: Remove outdated information in README.mdKai Koehne2020-08-191-3/+0
| | | | | Change-Id: Iefc1e13f5882ca69a2583f2454d00d9dfb42640d Reviewed-by: Alexandru Croitor <alexandru.croitor@qt.io>
* CMake: Implement configure -qreal <type>Joerg Bornemann2020-08-194-2/+7
| | | | | | | | | The configure argument -qreal <type> maps to the CMake argument -DQT_COORD_TYPE=<type>. Fixes: QTBUG-83325 Change-Id: I94970f31ccfb241b1dd4f1d9b6cef25d6684dc05 Reviewed-by: Alexandru Croitor <alexandru.croitor@qt.io>
* CMake: Fix usage of ccache when no executable was foundAlexandru Croitor2020-08-181-3/+8
| | | | | Change-Id: Ia9a44234cb074fa5ba2b1dc9ca22a676d1b2d4ce Reviewed-by: Joerg Bornemann <joerg.bornemann@qt.io>
* CMake: Handle -D, -I, -F and -L configure argumentsJoerg Bornemann2020-08-176-4/+75
| | | | | | | | | | | | | | Introduce new CMake variables and map -D to QT_EXTRA_DEFINES, -I to QT_EXTRA_INCLUDEPATHS, -L to QT_EXTRA_LIBDIRS, and -F to QT_EXTRA_FRAMEWORKPATHS. Those variables only affect the Qt build, not user projects. Fixes: QTBUG-85878 Change-Id: I229df2eed1505a2619068d0d32975962b052569a Reviewed-by: Alexandru Croitor <alexandru.croitor@qt.io>
* CMake: Fix typo in README about how to build Android for arm64Alexandru Croitor2020-08-171-1/+1
| | | | | | Task-number: QTBUG-85399 Change-Id: I764f5d5155d6548ca61d3217fb5bb10f5b15908f Reviewed-by: Joerg Bornemann <joerg.bornemann@qt.io>
* CMake: De-duplicate list input handling code in QtProcessConfigureArgsJoerg Bornemann2020-08-171-13/+10
| | | | | Change-Id: I9fd77dd81f67fcc9a0306ab0d627257f209cdb08 Reviewed-by: Alexandru Croitor <alexandru.croitor@qt.io>
* CMake: Re-implement configure/qmake's command line handling in CMakeJoerg Bornemann2020-08-171-100/+530
| | | | | | | | | | | | | | | | | | | | | | | | | We extend configurejson2cmake to read the "commandline" information from configure.json. This data is then translated to CMake function calls and written it into commandline.cmake files. We extend QtProcessConfigureArgs.cmake to pick up those commandline.cmake files to feed our command line handling code, which is a re-implementation of the command line handling in qt_configure.prf. The command line handler sets INPUT_xxx variables, similar to configure/qmake's config.input.xxx variables. The INPUT_xxx values are translated - to -DFEATURE_xxx=ON/OFF arguments if the input represents a feature, - to corresponding CMake variables if such a variable is known, - or to -DINPUT_xxx=yyy CMake arguments. Configure arguments that have an entry in cmake/configure-cmake-mapping.md are actually implemented. Other arguments are likely to need more work. Task-number: QTBUG-85373 Change-Id: Ia96baa673fc1fb88e73ba05a1afb473aa074b37d Reviewed-by: Alexandru Croitor <alexandru.croitor@qt.io>
* CMake: Split out some Android functions into a public API fileAlexandru Croitor2020-08-141-240/+0
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | To fix CMake Qt For Android projects to configure, we need to move some functions from a private CMake API file only, to a public one. Add Qt6AndroidMacros.cmake which will be loaded by Qt6Core package. We'll have to decide how we proceed with Qt5AndroidSupport.cmake, because that file automatically runs code when included in Qt5, and we usually don't want to do it. We'll also have to decide how to handle the define_property() calls that are still left in the private QtPlatformAndroid.cmake file. With this fix, Qt example CMake projects that use add_qt_gui_executable should now be buildable. An APK can be created with 'ninja apk'. Unfortunately Qt Creator 4.13 does not currently seem to support opening and building CMake Qt For Android projects properly. While the build succeeds after fiddling with the Kit settings, the APK deploy step fails to run (at least on my machine). So the simplest way to run the built APK is to open the android-build dir with Android Studio and launch the example application from there. Task-number: QTBUG-85399 Change-Id: I77f246331de7a6e9e6d4ba7d973730190138f136 Reviewed-by: Cristian Adam <cristian.adam@qt.io>
* CMake: Fix various issues with building CMake Android projectsAlexandru Croitor2020-08-141-10/+37
| | | | | | | | | | | | | | | | | | | | | Fix detection of qt android platform plugin by globbing inside the install qt6 prefix location. This is just a sanity check. Fix platform plugin detection for CMake standalone tests configured using qt-cmake-standalone-test, which used to look into the fake standalone prefix location instead of the real Qt location. Fix detection of stdlib path using CMAKE_SYSROOT. Add a global apk target that allows easier building of all apk targets defined in the project. Creation of this target can be opted out by setting QT_NO_GLOBAL_APK_TARGET to TRUE. Amends b1f8ca8032bd0500f356c55c335937f7fb89d3f5. Task-number: QTBUG-85399 Change-Id: Ic9c1646b4f00e0084fe3f4397df471b8f925afd8 Reviewed-by: Cristian Adam <cristian.adam@qt.io>
* CMake: Move QtPostProcess functions into QtPostProcessHelpers.cmakeAlexandru Croitor2020-08-143-641/+647
| | | | | | | | | | | The helpers can now be included manually in a project to call any required function. There was a use case for that in qttools, which was not possible because including QtPostProcess early would produce side effects. Task-number: QTBUG-86035 Change-Id: I05d5576bbac45d4b9e298b23aa2a33088d64968e Reviewed-by: Cristian Adam <cristian.adam@qt.io>
* CMake: Split QtBuild.cmake into smaller filesAlexandru Croitor2020-08-1432-5819/+5829
| | | | | | | | | | | | | | | | | | | | | | | 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>
* CMake: Allow opting out of global target promotionAlexandru Croitor2020-08-131-2/+19
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | The endless saga of fighting with qt_find_package and global target promotion. In certain scenarios we want to opt out of target promotion to global scope. One such case is in qttools with WrapLibClang and Threads::Threads. Threads::Threads will be found in the top-level scope via Qt6Dependencies. WrapLibClang is declared in src/ directory scope, and then we try to promote it ands its dependencies to the global scope, via qt_find_package() -> qt_find_package_promote_targets_to_global_scope(). This fails because we can't promote Threads::Threads due to it being added in a different subdirectory scope. Introduce 2 new functions. qt_internal_should_not_promote_package_target_to_global and qt_internal_disable_find_package_global_promotion. The first one is used to disable promotion of targets to global scope in qt_find_package. To mark a target not to be promoted, the second function is used. It will be used by qttools for the WrapLibClang case. Task-number: QTBUG-85877 Change-Id: If6caf10a94999402026517a623ae29e3ab1eeb7f Reviewed-by: Joerg Bornemann <joerg.bornemann@qt.io>
* CMake: Extend configure-cmake-mapping.mdJoerg Bornemann2020-08-131-44/+36
| | | | | Change-Id: Ie54b131c9a7b0f560fa735562fc4cbae4df35a49 Reviewed-by: Alexandru Croitor <alexandru.croitor@qt.io>
* CMake: Allow specifying a sysconfdir that's outside the prefixAlexandru Croitor2020-08-131-10/+17
| | | | | | | | | Also use the value to actually write it into qconfig.cpp so that qmake reports the right information. Change-Id: Icc4bf36b0dc6ad75d93ac16f39e5b361c0ce52b4 Fixes: QTBUG-81289 Reviewed-by: Joerg Bornemann <joerg.bornemann@qt.io>
* CMake: Fix empty value of CMAKE_SIZEOF_VOID_P when looking for toolsAlexandru Croitor2020-08-132-10/+1
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Our initial approach to looking for host Qt tools when cross-compiling to a platform with a different architecture bitness compared to the host one was to unset CMAKE_SIZEOF_VOID_P before calling find_package(Qt6FooTools) and then restoring the value. That works to bypass the architecture bitness test in the ConfigVersion files, but it also influences the paths that find_package() searches in, specifically the lib<arch> paths like /usr/lib64 will not be searched in. Fortunately since CMake 3.14, write_basic_package_version_file() can take an additional ARCH_INDEPENDENT parameter. This disables the architecture bitness test when looking for the package, while allowing to still search in the /usr/lib64 like paths. Use it when creating the QtFooToolConfigVersion.cmake files. One could argue we should actually check if the tool executables could run on the host system where find_package is called for cross-compilation. We could do that in another change if the problem ever arises. Amends 03aa74e40d8f1270e1bb28d0791e5bc376ffa0b7 Amends 914b367c7f6a117130b8a56338c46a8102a1f77f Change-Id: I1181ff637ac80064a6a8538170b28a41743fc90c Fixes: QTBUG-81672 Reviewed-by: Christophe Giboudeaux <christophe@krop.fr> Reviewed-by: Qt CI Bot <qt_ci_bot@qt-project.org> Reviewed-by: Joerg Bornemann <joerg.bornemann@qt.io>
* CMake: Introduce QtFeatureCommon.cmakeJoerg Bornemann2020-08-133-10/+12
| | | | | | | | This file provides common feature-functionality is supposed to be included by QtFeature.cmake and QtProcessConfigureArgs.cmake. Change-Id: Ifb483c2a9c4014d240c2a4d6ff07b5c0ceee9c3a Reviewed-by: Alexandru Croitor <alexandru.croitor@qt.io>
* CMake: Write QMAKE_MACOSX_DEPLOYMENT_TARGET to qconfig.priJoerg Bornemann2020-08-131-0/+2
| | | | | | | | | | | | | If the user specified CMAKE_OSX_DEPLOYMENT_TARGET=10.15 for the Qt build then building projects with qmake failed, because the mkspec hard-codes QMAKE_MACOSX_DEPLOYMENT_TARGET to 10.14. We now write QMAKE_MACOSX_DEPLOYMENT_TARGET to qconfig.pri to override the mkspecs' default. Fixes: QTBUG-85923 Change-Id: I6a39cfe047ac0f99e1da0ca0728d63c741bd4fed Reviewed-by: Alexandru Croitor <alexandru.croitor@qt.io>
* CMake: Add missing newline at the end of qconfig.priJoerg Bornemann2020-08-131-1/+1
| | | | | Change-Id: I929d74234b685bf0684d3067f7f958d474df20ff Reviewed-by: Alexandru Croitor <alexandru.croitor@qt.io>
* cmake: Suggest qt-cmake-private script for building other Qt modulesKai Koehne2020-08-121-2/+2
| | | | | | | | This automatically sets the CMake Generator to be the same as the one used for qtbase. Change-Id: If9e1a6942520417393055c572f0d892efca43d2e Reviewed-by: Alexandru Croitor <alexandru.croitor@qt.io>
* CMake: Fix Threads::Threads dependency handling with CMake < 3.18Alexandru Croitor2020-08-122-0/+22
| | | | | | | | | | | | | | | | | | | | Apparently CMake encods targets from different scopes with a different encoding scheme for earlier CMake versions. CMake 3.16.3: Threads::Threads::@<0x5604cb3f6b50> CMake 3.18.0: ::@(0x5604cb3f6b50);Threads::Threads;::@ Handle the earlier version approach as well. It needs to be done both when writing out 3rd party dependencies, as well as for lib prl files. Possibly in more places as well, but I didn't detect additional places yet. Amends 92ee9bd6b885879090ba57e49c8bd84a06d42b2b Task-number: QTBUG-85801 Task-number: QTBUG-85877 Change-Id: Ib348b51b2d623fb50d9080dba2beeb931d47a69c Reviewed-by: Cristian Adam <cristian.adam@qt.io>
* cmake, README: clearify the usage of '-' in feature namesRichard Moe Gustavsen2020-08-121-1/+2
| | | | | | | | | | It's not immediately obvious that you need to use all underscores for the feature name, so add a line that explaines it. Change-Id: I508eaf909c808fb0a93442f6e71428c18559b965 Reviewed-by: Alexandru Croitor <alexandru.croitor@qt.io> Reviewed-by: Joerg Bornemann <joerg.bornemann@qt.io>
* CMake: Expose public info about whether Qt is a shared lib buildAlexandru Croitor2020-08-121-0/+1
| | | | | | | | | | We expose it in the private QtBuildInternals package, but we need it also as public information for consumption in qt_import_qml_plugins() to decide whether it should do anything. Change-Id: If135ae596b4edaf8e2c458f6a2518b968c6d01c4 Reviewed-by: Qt CI Bot <qt_ci_bot@qt-project.org> Reviewed-by: Joerg Bornemann <joerg.bornemann@qt.io>
* CMake: Prepare ground work for static Qml plugins importingAlexandru Croitor2020-08-124-16/+51
| | | | | | | | | | | | | | | | | | | | | | | | | | | For qt_import_qml_plugins to work, it needs to have access to the Qml plugin targets by the time find_package(Qt6Qml) is called. To do that, we modify the generation of Qml plugin Config, Targets and Dependencies files to go into a special 'QmlPlugins' subfolder of the Qml package. The Qml package will then GLOB include all the Config files in that folder, to make them available whenever find_package(Qt6Qml) is called. This is similar to how the Qt plugins were glob included in the CMake integration of Qt 5.15. In fact that glob including is missing in Qt 6 for regular Qt plugins, and should be implemented in a following change. Currently the Qt Plugins config files that are included are hardcoded to the list of known plugins at Qt configuration time. As a drive-by to make this all work, the naming of the various Config and Dependencies files has been normalized to include the Qt6 prefix. This is done for both regular Qt plugins and Qml plugins. Task-number: QTBUG-85961 Change-Id: Id20da72337ca2945fa330ea6fb43535e44a83292 Reviewed-by: Joerg Bornemann <joerg.bornemann@qt.io>
* CMake: pro2cmake: Specify library versions for 3rd party libs part 2Alexandru Croitor2020-08-101-1/+6
| | | | | | | | | | Embed package versions into the qt_find_package calls for various Linux specific packages. Task-number: QTBUG-82917 Change-Id: I5d1cb623f81932dfae4658b8a3a89eedb71ea3af Reviewed-by: Qt CI Bot <qt_ci_bot@qt-project.org> Reviewed-by: Joerg Bornemann <joerg.bornemann@qt.io>
* CMake: pro2cmake: Specify library versions for 3rd party librariesAlexandru Croitor2020-08-106-69/+136
| | | | | | | | | | | | | | | | | | | | | | | | If certain 3rd party libraries have a version that's not suitable for Qt, the configure summary should say so, rather than use them and fail at build time. With the current situation, we have to duplicate the version information from the configure.json files in helper.py, by assigning the version number as an extra find_package variable. Rerunning configurejson2cmake then embeds this version info into the qt_find_package calls in configure.cmake. Some of the Find modules are rewritten to take the specified version into account when looking for the libraries. This involves moving around the code for creating a target, after calling find_package_handle_standard_args() so we know if a good enough version was found. Task-number: QTBUG-82917 Change-Id: I139748d8090e0630cda413362760034dc3483e11 Reviewed-by: Qt CI Bot <qt_ci_bot@qt-project.org> Reviewed-by: Joerg Bornemann <joerg.bornemann@qt.io>
* configure: Explicitly enable float-divide-by-zero with ubsanRobert Loehning2020-08-071-1/+1
| | | | | | | | | | Before clang 9, it was enabled by default when -fsanitize=undefined was set. Pick-to: 5.15 Change-Id: I0faf3ae1901d4badc6d265fa8081185be4360636 Reviewed-by: Edward Welbourne <edward.welbourne@qt.io> Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
* QDecompressHelper: Add brotli supportMÃ¥rten Nordheim2020-08-061-0/+43
| | | | | | Task-number: QTBUG-83269 Change-Id: If23b098ee76a4892e4c2c6ce5c635688d8d9138d Reviewed-by: Timur Pocheptsov <timur.pocheptsov@qt.io>
* CMake: Don't use lld linker for Android with a Windows hostAlexandru Croitor2020-08-061-1/+4
| | | | | | | | | | | | Most of the time lld just gets stuck (deadlock) waiting on some mutex, thus failing integrations. Amends 64c111e10fcb2f69855432177d76649b6b789fac Task-number: QTBUG-85911 Change-Id: Id73bf967a7aeb0e0cbccfaafe056b325c8711f82 Reviewed-by: Qt CI Bot <qt_ci_bot@qt-project.org> Reviewed-by: Cristian Adam <cristian.adam@qt.io>
* CMake: Fix prl files of static Qt buildsAlexandru Croitor2020-08-062-0/+10
| | | | | | | | | | | | | | | | | | | | | | | | | | | Static Qt plugins should not be included in the list of libraries of a prl file. They end up being there due to our circular dependency trick where the plugins depend on the module they belong to. This in turn causes the giant static plugin generator expressions to be processed in qt_collect_libs(), and the generated prl file ends up having target names like Qt6::QJpegPlugin which are obviously not linker flags. To eliminate the static plugins from prl files, add an additional dummy boolean generator expression '$<BOOL:QT_IS_PLUGIN_GENEX>' that always evaluates to true. We can string match on this expression in qt_collect_libs, and thus remove the whole static plugin genex entry. This should fix linking of apps with qmake that use a CMake-built static Qt. Task-number: QTBUG-85865 Task-number: QTBUG-85240 Task-number: QTBUG-85801 Change-Id: I949dc5edb10d94c4ab84ed430af7c164d8efaaa6 Reviewed-by: Cristian Adam <cristian.adam@qt.io>
* CMake: Properly handle CONFIG += thread aka Threads::ThreadsAlexandru Croitor2020-08-065-1/+102
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | mkspecs/features/qt.prf adds a dependency on the system threading library if the Qt Core thread feature is enabled. Because qt.prf is loaded by any public or internal Qt project, it's essentially a public dependency for any Qt consumer. To mimic that in CMake, we check if the thread feature is enabled, and and set the Threads::Threads library as a dependency of Qt6::Platform, which is a public target used by all Qt modules and plugins and Qt consumers. We also need to create a Qt6Dependencies.cmake file so we find_package(Threads) every time find_package(Qt6) is called. For the .prl files to be usable, we have to filter out some CMake implementation specific directory separator tokens 'CMAKE_DIRECTORY_ID_SEP' aka '::@', which are added because we call target_link_libraries() with a target created in a different scope (I think). As a result of this change, we shouldn't have to hardcode Threads::Threads in other projects, because it's now a global public dependency. Task-number: QTBUG-85801 Task-number: QTBUG-85877 Change-Id: Ib5d662c43b28e63f7da49d3bd77d0ad751220b31 Reviewed-by: Qt CI Bot <qt_ci_bot@qt-project.org> Reviewed-by: Cristian Adam <cristian.adam@qt.io>
* CMake: Fix build with custom INSTALL_INCLUDEDIRJoerg Bornemann2020-08-063-14/+13
| | | | | | | | | | | | | The include directory in Qt's build directory is always named "include", no matter what the value of INSTALL_INCLUDEDIR is. The main reason is that the name "include" is hard-coded in syncqt. The INSTALL_INCLUDEDIR variable must only affect the installation location of headers. Fixes: QTBUG-85893 Change-Id: I5367bc589cba129eb41817e2b58d470f730bb5ac Reviewed-by: Alexandru Croitor <alexandru.croitor@qt.io>
* CMake: Don't build debug tools by default in debug_and_release buildsJoerg Bornemann2020-08-052-0/+10
| | | | | | Fixes: QTBUG-85411 Change-Id: Idd9664d1a9143c31f28549a72823a82df1cff7ec Reviewed-by: Alexandru Croitor <alexandru.croitor@qt.io>
* CMake: Don't use std=gnu++11 when building Qt internal targetsAlexandru Croitor2020-08-052-0/+5
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | The logic is a bit involved in qmake. The Qt internal qt_common.prf adds CONFIG += strict_c++ which applies to qt modules, qt plugins, qml plugins, qt helper libs, winmain and qt_apps, qt_tools, but NOT tests (which is important because the tests on Windows MinGW fail to build without the GNU extensions). Then default_post.prf checks for the strict_c++ value and either uses the strict or non-strict C++ standard flags. default_post.prf is loaded for all qmake projects, not just the Qt internal ones. Now CMake doesn't provide a transitive based option to disable C++ GNU extensions with a mechanism similar to target_compile_features. It only provides the CXX_EXTENSIONS property and it's associated CMAKE_CXX_EXTENSIONS variable. We can't set the variable at a directory scope, because that is too coarse grained. So we rely on setting the property via a function in every relevant qt_add_<target> function. Now the naming of the function is weird. We name the function as qt_internal_<...>, because it's not meant to be used by Qt users. We prepend an underscore to the name because we need to place it in Qt6CoreMacros, so that the function can be called by qt_add_qml_module which IS a public function. That's because in Qt5 load(qml_plugin) was private API, but in Qt 6 + CMake we decided to make qt_add_qml_module() as public API. Change-Id: Id014626b087d590e25cb46843f93d0c67fc36e44 Reviewed-by: Joerg Bornemann <joerg.bornemann@qt.io>