summaryrefslogtreecommitdiffstats
path: root/cmake
Commit message (Collapse)AuthorAgeFilesLines
...
* CMake: Bump min required CMake version for shared Qt builds to 3.16Alexandru Croitor2021-07-281-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. Pick-to: 6.2 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>
* CMake: Keep public include header locations for internal module priJaeyoon Jung2021-07-261-1/+1
| | | | | | | | | Amends f254d62cb1807d5bd9ee2e23ef64d4ca2d1b6809. Task-number: QTBUG-95303 Pick-to: 6.1 6.2 Change-Id: Ica8d2850fe427b780d62cd9a9528f387a7ea1b79 Reviewed-by: Alexandru Croitor <alexandru.croitor@qt.io>
* CMake: Use namespaced variables in Qt6*Dependencies.cmakeLi Xinwei2021-07-245-99/+98
| | | | | | | Pick-to: 6.2 6.1 Change-Id: I166988020cfd9750a4d58e519742215d0c03ad3e Reviewed-by: Qt CI Bot <qt_ci_bot@qt-project.org> Reviewed-by: Alexandru Croitor <alexandru.croitor@qt.io>
* Fix generated pri and prl filesLi Xinwei2021-07-175-6/+17
| | | | | | | | | | | | | | | Quote the paths after "-L". Get MSVC’s implicit link directories from $ENV{LIB}. Fix some issues cause by Inconsistent case. Amends 2c49f85380d7ad79d9473e0f42e7afaa36d31af9 Fixes: QTBUG-95198 Pick-to: 6.2 6.1 Change-Id: Ie82f10b088e2764396377726340509f24a4ae8e7 Reviewed-by: Alexandru Croitor <alexandru.croitor@qt.io>
* CMake: Clean up and simplify qt6_extract_metatypes implementationAlexandru Croitor2021-07-161-1/+1
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Remove copying of json files in non-prefix builds. Previously, this was done to mimic the directory layout of prefix builds in a non-prefix build, but the extra complexity is not worth it. Keeping the files in the build directories of each repo in a non-prefix build should be good enough. As a result, we don't need to distinguish which file path should be passed in INTERFACE_SOURCES. Now we have only 2 paths to consider, the BUILD_INTERFACE one and the INSTALL_PREFIX one, rather than 3 different paths. Move the code that handles installation closer together. Rename the internal COPY_OVER_INSTALL option to ___QT_INTERNAL_NO_INSTALL. We might want to expose it as a public option later, but it depends on whether we will disable default installation for user projects. Remove assignment of some properties that are not used anymore. Amends c431e2d33c2b13dee8b43a08c267c20ec1ae9654 Pick-to: 6.2 Task-number: QTBUG-94942 Change-Id: I3a26d1988987b2ce7c7d01d2311c13b3da3175a8 Reviewed-by: Qt CI Bot <qt_ci_bot@qt-project.org> Reviewed-by: Joerg Bornemann <joerg.bornemann@qt.io>
* CMake: Apply bitcode flags to internal plugin object lib initializersAlexandru Croitor2021-07-163-4/+12
| | | | | | | | | | | | | | | | | | | | | | All internal libraries, plugins, object libraries (resources, plugin initializers) need to be built with bitcode flags when targeting iOS. Internal here means all libraries added by qt_internal_add_X functions or associated with internal libraries. We didn't do that for plugin initializers, which were added not too long ago. Extract the logic that links to Qt::PlatformModuleInternal into a separate function to be used for object libraries. Use it for resources and plugin initializers. It will also be used in qtdeclarative for qml plugin initializers. Pick-to: 6.2 Task-number: QTBUG-95208 Change-Id: I366996078f5e9d1c2d2797f6b81c522ee99529e3 Reviewed-by: Qt CI Bot <qt_ci_bot@qt-project.org> Reviewed-by: Joerg Bornemann <joerg.bornemann@qt.io>
* CMake: Don't propagate -fapplication-extension to user projectsAlexandru Croitor2021-07-165-2/+28
| | | | | | | | | | | | | | | | | | | | | | | | Both the compiler and linker -fapplication-extension flag should only be applied when building Qt's libraries (not executables). It's up to the user project whether their code will be restricted with application-extension-only APIs. In qmake that can be achieved by adding to the qmake project CONFIG += app_extension_api_only In CMake it can be achieved by either adding the compiler and link flags in the project directly (using target_X_options) or by setting the appropriate setting in the Xcode project when using the Xcode generator. Amends e189126f1ae1d2fa2ad0f95ee2c4aa72c770a97b Pick-to: 6.2 Task-number: QTBUG-95199 Change-Id: Ie7a764d460a89c7650391abff0fcc5abfcabef64 Reviewed-by: Qt CI Bot <qt_ci_bot@qt-project.org> Reviewed-by: Joerg Bornemann <joerg.bornemann@qt.io>
* CMake: Fix bitcode linker flags not to be added on iOSAlexandru Croitor2021-07-161-1/+0
| | | | | | | | | | | | | | | | | | | We shouldn't force add the bitcode linker flags to user projects. And we don't link anything when building Qt for iOS itself, we only archive object files into static libraries. The final decision whether bitcode should be used is up to the Xcode project. That is controlled by Xcode's ENABLE_BITCODE option. Bitcode compile flags are still added when building Qt itself. Amends a0468331761b497992e9d554c210583781308272 Pick-to: 6.1 6.2 Task-number: QTBUG-95199 Change-Id: I04c77f659b82269bb8010ea262b2e51f36e9def3 Reviewed-by: Qt CI Bot <qt_ci_bot@qt-project.org> Reviewed-by: Joerg Bornemann <joerg.bornemann@qt.io>
* CMake: Force Integrity to be a static Qt buildAlexandru Croitor2021-07-151-16/+24
| | | | | | | | | | | | | This was the case in Qt 5.15 as well. The CMake toolchain file that Qt's CI is using is already setting BUILD_SHARED_LIBS to OFF, but it's better to be explicit like we are with WebAssembly and iOS. Pick-to: 6.2 Change-Id: Ief17259c15690a97337e9df451663718601c2a52 Reviewed-by: Alexey Edelev <alexey.edelev@qt.io> Reviewed-by: Joerg Bornemann <joerg.bornemann@qt.io>
* Report multi-arch targets in the configure summaryAllan Sandfeld Jensen2021-07-141-2/+7
| | | | | | | | Otherwise it will confusingly only list the host arch Pick-to: 6.2 Change-Id: Ic6d080f1fd9ebfa260ce7c35bd5e5b4ee686f083 Reviewed-by: Alexandru Croitor <alexandru.croitor@qt.io>
* fix wrong argumentLi Xinwei2021-07-141-1/+1
| | | | | | | | amends 5b136abd21803988f96b9b66c992822efbef97ec Pick-to: 6.2 Change-Id: I8dee597c4ba41ecd07289b724f5e2b52ba705a9f Reviewed-by: Joerg Bornemann <joerg.bornemann@qt.io>
* CMake: Fix IMPORTED_IMPLIB to be set for shared libraries on WindowsAlexandru Croitor2021-07-141-1/+1
| | | | | | | | | | The correct variable to check is WIN32, not WINDOWS. Amends 85e25d93b3b99fbeae8541586252df2cb099081d Pick-to: 6.2 Change-Id: I4570eb5a124bcaa0bd38135dd7c7f48345c40c9d Reviewed-by: Friedemann Kleint <Friedemann.Kleint@qt.io>
* Use module interface name as OUTPUT_NAMEAlexey Edelev2021-07-131-1/+4
| | | | | | | | | | For internal modules we should keep the name of the file in file system consistent with previous Qt versions. Pick-to: 6.2 Fixes: QTBUG-95077 Change-Id: I02e4fced0fc3172e60f07bc7d1515e23744db567 Reviewed-by: Alexandru Croitor <alexandru.croitor@qt.io>
* Don't repeat conditions of use_*_linker features in QtFeature.cmakeJoerg Bornemann2021-07-131-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>
* Move the logic associated with platform definition directoryAlexey Edelev2021-07-132-28/+30
| | | | | | | | | | | | | | | | | | Since platform definition directory is used as an interface include path of the Qt::Platform target, it makes sense to define it for this target only. Also the definition of cached values that contain path to platform definition looks redundand. The definition of QT_PLATFORM_DEFINITION_DIR from command line doesn't make any sense since build procedure doesn't take it into account when installing mkspecs and the use if the user-provided QT_PLATFORM_DEFINITION_DIR value as a Qt::Platform include directory causes inconsistency in the prefixed builds. INSTALL_MKSPECSDIR and QT_QMAKE_TARGET_MKSPEC should be used instead. Change-Id: I3636c57b835cb84511a358a0910cc482c5fbd81e Reviewed-by: Qt CI Bot <qt_ci_bot@qt-project.org> Reviewed-by: Alexandru Croitor <alexandru.croitor@qt.io>
* Warn on any PUBLIC usage requirements specified for Qt pluginsJoerg Bornemann2021-07-121-1/+1
| | | | | | | | | | | | Repositories have been changed to be free of this warning. We're now changing the default of QT_WARN_PLUGIN_PUBLIC_KEYWORDS to ON. Set this variable to OFF to disable the warnings. Pick-to: 6.2 Change-Id: Ie37a4df1032f5b1e9152d970e8a14c574ed70241 Reviewed-by: Craig Scott <craig.scott@qt.io> Reviewed-by: Alexandru Croitor <alexandru.croitor@qt.io>
* CMake: Fix reconfiguration error when features have EMIT_IF conditionsAlexandru Croitor2021-07-091-4/+13
| | | | | | | | | | | | | | | | | | | | | | | | | Previously, if a feature was marked as not to be emitted and there was no user provided value for that feature, the build system would still save the user provided value in FEATURE_foo with a value of ON (if the conditions were met). After a reconfiguration, the build system would hit the code path that checks if the user provided a value for the non-emitted feature, and would then warn about it and reset the feature value to OFF. This would cause errors when reconfiguring a user project, complaining that a feature value has changed. Make sure to not save the user provided value for a non-emitted feature and to always set its internal feature value to OFF. Amends c4f5762b20dc20bab3cc62e9166d0e5b36e21cc6 Pick-to: 6.2 Fixes: QTBUG-94921 Change-Id: I257c7fd795c8a6aeba3348cb72522e4f0b006dc9 Reviewed-by: Qt CI Bot <qt_ci_bot@qt-project.org> Reviewed-by: Joerg Bornemann <joerg.bornemann@qt.io>
* CMake: Rename and document the feature evaluation functionsAlexandru Croitor2021-07-091-25/+60
| | | | | | | | | | | | | | | | | | | | Rename various functions and variables to hopefully make the behavior of feature evaluation clearer. The previous names like 'set_value' or 'set_cache_value' or 'cache' were too generic and unclear. One would have to carefully read the code to understand what was actually set. Add some doc comments about what FEATURE_foo and QT_FEATURE_foo represent. Amends c4f5762b20dc20bab3cc62e9166d0e5b36e21cc6 Pick-to: 6.2 Task-number: QTBUG-94921 Change-Id: Ie6a7b83a4d54a83976b2706d4af82b39832d79f1 Reviewed-by: Qt CI Bot <qt_ci_bot@qt-project.org> Reviewed-by: Joerg Bornemann <joerg.bornemann@qt.io>
* CMake: Use correct MSVC runtime library for Qt object librariesAlexandru Croitor2021-07-093-8/+13
| | | | | | | | | | | | | | | | | | | | | | | | If Qt was configured with -static-runtime which implies MultiThreaded -MT flag, the plugin initializer object libraries were still compiled with the default -MD flag. When an application linked to Qt, that caused linking to fail with mismatched symbol errors between the application symbols and the plugin initializer object library symbols. Make sure to set the MSVC_RUNTIME_LIBRARY property on both plugin initializer and resource object libraries, depending on the value of QT_FEATURE_static_runtime. We did set the property for resources added by qt_internal_add_resource, but not for the resource created by the public qt6_add_resources counterpart. Pick-to: 6.2 Fixes: QTBUG-95043 Change-Id: Ia543cd0241db94a12080be2655ad420fe9ad3f24 Reviewed-by: Qt CI Bot <qt_ci_bot@qt-project.org> Reviewed-by: Joerg Bornemann <joerg.bornemann@qt.io>
* CMake: Place internal apps in the correct output directoryAlexandru Croitor2021-07-094-23/+31
| | | | | | | | | | | | | | In a -debug-and-release build, apps were placed under bin/Release rather than just bin. Apply the logic we use for tools for apps as well. Rename and move the common functions into QtTargetHelpers.cmake. Pick-to: 6.2 Fixes: QTBUG-95028 Change-Id: I5a9082ea50c9238c8fcf0c6dd099708fbc571bf8 Reviewed-by: Qt CI Bot <qt_ci_bot@qt-project.org> Reviewed-by: Joerg Bornemann <joerg.bornemann@qt.io>
* Hide QT_USE_BUNDLED_ CACHE variables from GUIAlexey Edelev2021-07-081-2/+2
| | | | | | | | | Make QT_USE_BUNDLED_ INTERNAL to hide them from GUI like QtCreator's CMake configurator. Pick-to: 6.1 6.2 Change-Id: Id9dcee31c69b579bbe38611cabb98e46550b0e89 Reviewed-by: Alexandru Croitor <alexandru.croitor@qt.io>
* Make QT_HAVE_LINK_ORDER_MATTERS INTERNAL to hide from GUIAlexey Edelev2021-07-081-2/+2
| | | | | | | | | Hide QT_HAVE_LINK_ORDER_MATTERS from GUI like QtCreator's CMake configurator. Pick-to: 6.1 6.2 Change-Id: I9591092f0902ad17ff260a1ca4494239a7acf6fa Reviewed-by: Alexandru Croitor <alexandru.croitor@qt.io>
* CMake: Set IMPORTED_{SONAME|IMPLIB} for shared libs onlyJoerg Bornemann2021-07-081-9/+32
| | | | | | | | | | | | In our *AdditionalTargetInfo.cmake we now set above target properties for shared libs only, not executables. IMPORTED_IMPLIB is only set for Windows. IMPORTED_SONAME is only set for non-Windows platforms. Pick-to: 6.2 Change-Id: If7f01e6bf5183cca0ac90f9afffd57c41b34dccd Reviewed-by: Alexandru Croitor <alexandru.croitor@qt.io>
* Fix build of Debug projects against debug-and-release non-prefix QtJoerg Bornemann2021-07-081-2/+21
| | | | | | | | | | | | | | | | | | | Building a CMake project with CMAKE_BUILD_CONFIG=Debug was broken for non-prefix debug-and-release builds of Qt. In debug-and-release builds we set EXCLUDE_FROM_ALL on tools in the Debug configuration. In non-prefix builds we export(EXPORT) targets, and that also contains the non-existent Debug variants of the tools. In prefix builds, we install(EXPORT) instead, which only exports what is built and installed. Consequently, we now remove the DEBUG-related import information if the debug variant if the target binary does not exist. Pick-to: 6.2 Fixes: QTBUG-95027 Change-Id: I37766d5ab1e2795bcb91a348e7e72150e8a00f82 Reviewed-by: Alexandru Croitor <alexandru.croitor@qt.io>
* fix warning in cborparser with gcc 11.1Andreas Buhr2021-07-071-1/+2
| | | | | | Pick-to: 6.2 Change-Id: Ie8270f2b156b194dedd115a97b93f7f800af055e Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
* Fix platform definition directory in top-level buildAlexey Edelev2021-07-071-1/+1
| | | | | | | | | | | | | | QT_BUILD_DIR should be used instead of CMAKE_BINARY_DIR as a base directory for platform definition when building a non-prefixed build since artifacts are copied to qtbase directory for top-level build. Amends 478f5fcde66a49b710c427447916a0ee0e4d9e0a Pick-to: 6.1 6.2 Task-number: QTBUG-94973 Change-Id: I5cce16fdc7f760b954222ae67a4b85d4beea7f13 Reviewed-by: Alexandru Croitor <alexandru.croitor@qt.io>
* CMake: Fix typo in function nameCraig Scott2021-07-072-3/+3
| | | | | | Pick-to: 6.2 Change-Id: I72ab657670ca6fa460b3495f85d6edd920ee2c8a Reviewed-by: Alexandru Croitor <alexandru.croitor@qt.io>
* Restore default installation prefix from Qt 5Joerg Bornemann2021-07-061-6/+17
| | | | | | | | | | | | | | | | | Change the default installation prefix to C:/Qt/Qt-${version} on Windows and /usr/local/Qt-${version} elsewhere. This is what's expected by users coming from Qt5, and setting the installation prefix to "/usr/local" manually is easier than setting the versioned variant "/usr/local/Qt-6.2.0". [ChangeLog][Build System] The installation prefix now defaults to /usr/local/Qt-${version} and C:/Qt/Qt-${version} like it did in Qt 5. Fixes: QTBUG-91632 Pick-to: 6.2 Change-Id: I8ce57b1b18084c705b194c776e038cc807a6ed5e Reviewed-by: Alexandru Croitor <alexandru.croitor@qt.io>
* Remove unsupported host-related configure optionsJoerg Bornemann2021-07-062-18/+0
| | | | | | | | | | | | | The following host-related configure options were unsupported since Qt 6.0 and are now completely removed: -hostprefix -external-hostbindir -host*dir (except -hostdatadir) -android-ndk-host Pick-to: 6.2 Change-Id: Ib69d90c40ef546f61bf87b1f443eb9d10f7a5a21 Reviewed-by: Alexandru Croitor <alexandru.croitor@qt.io>
* Remove outdated information from configure-cmake-mapping.mdJoerg Bornemann2021-07-061-2/+0
| | | | | | Pick-to: 6.2 Change-Id: I5101a3d7d07e4c0e818fb005707d99c6afe8f589 Reviewed-by: Alexandru Croitor <alexandru.croitor@qt.io>
* Fix the detection of platform definitions directoryAlexey Edelev2021-07-052-26/+34
| | | | | | | | | | | | | | | | | | Platform definition directory is defined when building qtbase. Depending on the build type (prefixed/non-prefixed) it should point: - To the source directory when building prefixed qtbase. - To the installation directory of the prefixed qtbase when building consumer projects. - To the build directory of non-prefixed qtbase when building non-prefixed qtbase or consumer projects. TODO: It is desirable to move the logic asssociated with Qt platform definition to the qt_internal_setup_public_platform_target function. Pick-to: 6.1 6.2 Fixes: QTBUG-94973 Change-Id: I8530613f9b2029834c66206bbdf02475528a4640 Reviewed-by: Alexandru Croitor <alexandru.croitor@qt.io>
* Make Android detection more robustJoerg Bornemann2021-07-051-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. Pick-to: 6.2 Fixes: QTBUG-94955 Change-Id: Ie2f0ac0963f90f09805e311111bb6912d4325ada Reviewed-by: Alexandru Croitor <alexandru.croitor@qt.io>
* Fix typo in function name qt_auto_detect_vcpkgJoerg Bornemann2021-07-021-2/+2
| | | | | | | Pick-to: 6.2 Change-Id: Ie0fd74a9e1faf8dc55faac1940d100af72cf8030 Reviewed-by: Alexey Edelev <alexey.edelev@qt.io> Reviewed-by: Alexandru Croitor <alexandru.croitor@qt.io>
* Use target_link_options to propagate object librariesAlexey Edelev2021-07-023-4/+66
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | target_link_options are placed by CMake at the beginning of a linker line. This gives us an opportunity to use the function to propagate object libraries. This change adds one more check in the root Config.cmake file. If CMP0099 policy is enabled, CMake enables propagating of the linking options when linking two static libraries using the PRIVATE linking visibility, so we can rely on the correct linking order and expect object libraries to be propagated. Note that on the platforms where cmake version is higher than 3.16 Qt uses CMP0099 NEW in functions like qt_add_executable. This means that at the moment of creating an executable target the TARGET_POLICY genex will also be NEW, so we do not take into the account the user defined CMP0099. If the CMP0099 policy is not available for a certain CMake version we skip the TARGET_POLICY check and simply disable propagation of the object libraries using target_link_options for both user and Qt libraries. This is applicable for the CMake versions 3.16 and less. Linking approaches have the following priorities(from higher to lower) after this change: - target_link_libraries - works if link order matters not or CMake version greater equal 3.21. - target_link_options - works if CMP0099 is set to NEW by user or if the CMake version is greater than or equal to 3.17 and an executable is created using Qt functions. - object library finalizer - works if CMake version is greater equal 3.19 or qt6_finalize_target is called explicitly. - target_sources - is used when all the other approaches could not be used. Amends a1fd4f51ada82854f35654158a334454e760a9f7 Amends 3329212815777e33dfb4697b748d10927d73f44c Pick-to: 6.2 Change-Id: I14f88caeb04e357191c840abeab89b03e210b796 Reviewed-by: Qt CI Bot <qt_ci_bot@qt-project.org> Reviewed-by: Alexandru Croitor <alexandru.croitor@qt.io>
* Revert "Make toolchain inspection more robust"Joerg Bornemann2021-07-022-48/+4
| | | | | | | | | | | | | | | | | This reverts commit 7c62caa3555d247be569102d8f01b3e7ae362b8a. Certain toolchain files cannot be read in CMake script mode with CMake versions >= 3.20. For example, the vcpkg toolchain file overrides add_executable, and that fails with CMake 3.20: CMake Error at D:/dev_tools/vcpkg/scripts/buildsystems/vcpkg.cmake:662 (function): Built-in flow control command "add_executable" cannot be overridden. Pick-to: 6.2 Fixes: QTBUG-93627 Change-Id: Ib6e6352dff50b9684dcf81401d138e27e16292c3 Reviewed-by: Alexandru Croitor <alexandru.croitor@qt.io>
* CMake: Fix Vulkan to be found when targeting AndroidAlexandru Croitor2021-07-012-0/+43
| | | | | | | | | | | | | | | | | | | | | | | Introduce two new packages WrapVulkanHeaders and WrapVulkan similar to the OpenSSL wrapper packages. WrapVulkanHeaders uses FindVulkan and is marked as found if Vulkan headers are found (that's the only part the Qt build requires). The WrapVulkan package is currently not used, but is there for symmetry. The Vulkan feature is now disabled by default on QNX, because the QNX toolchain file in the CI does not set CMAKE_FIND_ROOT_PATH_MODE-like variables and CMake ends up finding host Vulkan headers causing the build to break. Pick-to: 6.2 Fixes: QTBUG-92157 Change-Id: I05309821f866456cd42e7f85bf8b76ba099df656 Reviewed-by: Alexey Edelev <alexey.edelev@qt.io> Reviewed-by: Assam Boudjelthia <assam.boudjelthia@qt.io> Reviewed-by: Alexandru Croitor <alexandru.croitor@qt.io>
* CMake: Be more explicit about found OpenSSL variablesAlexandru Croitor2021-07-012-2/+13
| | | | | | | | | | | | Specifying the variables as required variable will show the found paths in the configure output. Pick-to: 6.2 Task-number: QTBUG-94355 Change-Id: I985a3585f37b38e25b6be4fae5d42c82e06517de Reviewed-by: Qt CI Bot <qt_ci_bot@qt-project.org> Reviewed-by: Alexey Edelev <alexey.edelev@qt.io> Reviewed-by: Joerg Bornemann <joerg.bornemann@qt.io>
* CMake: Pierce through LINK_ONLY deps in finalizer dep traversalAlexandru Croitor2021-06-291-0/+5
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Ensure that the finalizer approach of __qt_internal_propagate_object_library considers $<LINK_ONLY:> libraries when traversing the dependencies of a target. The issue was discovered when using the Quick.Shapes QML module in a static build. The module has both a backing library and a plugin. The backing library has some resource objects associated with it. When the targets are exported, the plugin INTERFACE_LINK_LIBRARIES has a $<LINK_ONLY:QuickShapes> dependency. This ensures that the library will be linked, but depending on which linking approach in __qt_internal_propagate_object_library is used, the resources might not be linked to the final executable. The resources are linked correctly when using the target_link_libraries approach, but not when using the finalizer or target_sources approach. This change fixes the finalizer approach, but the target_sources approach is still broken. Amends a1fd4f51ada82854f35654158a334454e760a9f7 Pick-to: 6.2 Change-Id: Ifbb91a17d388c3dc4263e17ec0d3bd5627b57cb4 Reviewed-by: Alexey Edelev <alexey.edelev@qt.io> Reviewed-by: Alexandru Croitor <alexandru.croitor@qt.io>
* Throw FATAL_ERROR if specified platform doesn't existAlexey Edelev2021-06-251-0/+11
| | | | | | | | | | | If user specifies non-existing platform build fails in some non-obvious place, since qplatfromdefs.h couldn't be found. Add an explicit error if the defined platform folder doesn't exists in Qt sources. Change-Id: Id847d57a6f9cc4f463e697b474b8a669cd041fb8 Reviewed-by: Alexandru Croitor <alexandru.croitor@qt.io>
* CMake: Fix 'Cannot find source file' error with older CMakesAlexandru Croitor2021-06-251-2/+10
| | | | | | | | | | | | | | | | | Configuring a static qtdeclarative with CMake versions older than 3.18.0 fails at generation phase with CMake Error at cmake/QtExecutableHelpers.cmake:28 (add_executable): Cannot find source file: some_path/some_target_plugin_imports_Gui.cpp Marking the generated file as GENERATED explicitly solves the issue. Pick-to: 6.1 6.2 Change-Id: Ife0eba61a1aab4f988d9fe7e2217d30eb96774a7 Reviewed-by: Alexey Edelev <alexey.edelev@qt.io> Reviewed-by: Joerg Bornemann <joerg.bornemann@qt.io>
* CMake: Propagate sanitizer flags to public projectsAlexandru Croitor2021-06-257-59/+58
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Ensure that Qt user projects build with sanitizer flags if Qt was configured with any of the sanitizers enabled. To compile Qt with sanitizer support enable any of Qt sanitizer features. Passing -DECM_ENABLE_SANITIZERS=address to CMake is NOT supported anymore. When configuring Qt using CMake directly, pass -DFEATURE_sanitizer_address=ON -DFEATURE_sanitizer_undefined=ON instead of -DECM_ENABLE_SANITIZERS=address;undefined When configuring Qt with the configure script pass -sanitize address -sanitize undefined as usual. QtConfig.cmake now records the sanitizer options that should be enabled for all consuming projects based on the enabled Qt features. This applies to internal Qt builds as well as well as tests an examples. The recorded sanitizer options are assigned to the ECM_ENABLE_SANITIZERS variable in the directory scope where find_package(Qt6) is called. The ECMEnableSanitizers module is included to add the necessary flags to all targets in that directory scope or its children. This behavior can be opted out by setting the QT_NO_ADD_SANITIZER_OPTIONS variable in projects that use Qt and might be handling sanitizer options differently. Amends 7e03bc39b8bcdaa4e83e72ac99e117561c124951 Pick-to: 6.2 Fixes: QTBUG-87989 Task-number: QTBUG-92083 Change-Id: I2e3371147277bdf8f55a39abaa34478dea4853a6 Reviewed-by: Robert Löhning <robert.loehning@qt.io> Reviewed-by: Fabian Kosmale <fabian.kosmale@qt.io>
* CMake: Handle fuzzer-no-link sanitizer feature name correctlyAlexandru Croitor2021-06-251-1/+12
| | | | | | | | Pick-to: 6.2 Task-number: QTBUG-87989 Change-Id: Ife42f1fe001c5fafd10981f23dcd387cacc15276 Reviewed-by: Alexey Edelev <alexey.edelev@qt.io> Reviewed-by: Joerg Bornemann <joerg.bornemann@qt.io>
* CMake: Restore Qt-custom sanitizer additions to ECMEnableSanitizersAlexandru Croitor2021-06-251-1/+6
| | | | | | | | | | | Restores addition of 'float-divide-by-zero' to undefined sanitizer flags as well as the custom fuzzer-no-link option. Pick-to: 6.2 Task-number: QTBUG-87989 Change-Id: Icde1e5d31083ce1b6128ab45b0e9df5ae69736a3 Reviewed-by: Alexey Edelev <alexey.edelev@qt.io> Reviewed-by: Joerg Bornemann <joerg.bornemann@qt.io>
* CMake: Update ECM sanitizer module to latest versionAlexandru Croitor2021-06-252-112/+97
| | | | | | | | | | | To bring support for sanitizers when using MSVC. Pick-to: 6.2 Task-number: QTBUG-87989 Change-Id: I7a8ebf8fdaa31669df82d232fd9eae4e72407b92 Reviewed-by: Alexey Edelev <alexey.edelev@qt.io> Reviewed-by: Mårten Nordheim <marten.nordheim@qt.io> Reviewed-by: Joerg Bornemann <joerg.bornemann@qt.io>
* Implement generating of a module cpp export headerAlexey Edelev2021-06-243-6/+96
| | | | | | | | | | Add an option that automatically generates an export header for a Qt module. The header contains only Q_DECL_EXPORT/Q_DECL_IMPORT related content, so it's not a full replacement of 'global' header files. Task-number: QTBUG-90492 Change-Id: I250d1201b11d4096b7e78e61cbf4565945fe6517 Reviewed-by: Alexandru Croitor <alexandru.croitor@qt.io>
* Disable forced full optimization if QT_USE_DEFAULT_CMAKE_OPTIMIZATION_FLAGS=ONAlexey Edelev2021-06-241-0/+5
| | | | | | | Pick-to: 6.2 Task-number: QTBUG-94753 Change-Id: Ib9dda1a96f3123394e3b3d4f84feac8cedd18b89 Reviewed-by: Alexandru Croitor <alexandru.croitor@qt.io>
* Fix QT_HOST_DATA for builds setting INSTALL_MKSPECSDIRJoerg Bornemann2021-06-231-6/+0
| | | | | | | | | | | | | | | | | | | | In a Qt build that was configured with INSTALL_MKSPECSDIR set to something different than INSTALL_DATADIR, the qmake property QT_HOST_DATA was wrong. Consequently, mkspecs could not be loaded, rendering qmake dysfunctional. The reason was that we considered every QT_HOST_xxx property to have the same value as QT_INSTALL_xxx in a non-cross build. This is not true for QT_HOST_DATA, because users might want to set INSTALL_DATADIR to "foo" but INSTALL_MKSPECSDIR to "bar/mkspecs". Move the unused determination of the host data dir to the QtLibraryInfo lib and handle QT_HOST_DATA specially. Fixes: QTBUG-94591 Pick-to: 6.2 Change-Id: I2c44cda8405ff1d14391254fcd1d9b1361cb5855 Reviewed-by: Alexandru Croitor <alexandru.croitor@qt.io>
* MSVC: Enable warnings-are-errors for latest Visual Studio 2019Kai Köhne2021-06-231-4/+3
| | | | | | | | | Also remove handling of older versions, because we only support Visual Studio 2019 currently Pick-to: 6.2 Change-Id: If66a46d970047fe25582e323df74e0a904ee92da Reviewed-by: Volker Hilsheimer <volker.hilsheimer@qt.io>
* wasm: don’t set exit_runtimeMorten Sørvig2021-06-231-1/+1
| | | | | | | | | | | | | | | | | | Go with Emscripten’s default of not shutting down on main() exit; this allows for writing main() in such a way that avoids the exec() workaround. Existing main() implementations (which do use the exec() workaround) do not shut down Qt cleanly anyway, so we gain little by shutting down the Emscripten runtime. Applications can set this flag if they do want to shut down on main() exit: LFAGS += -s EXIT_RUNTIME=1 Change-Id: I52e1cc2bc907d1d2146822713e39b7610db3f95b Reviewed-by: Tor Arne Vestbø <tor.arne.vestbo@qt.io> Reviewed-by: Lorn Potter <lorn.potter@gmail.com>
* Disable -Werror=stringop-overflow on GCC >= 10Giuseppe D'Angelo2021-06-231-0/+8
| | | | | | | | | | | There's a number of upstream bugs that cause false positives; do not make them errors. Change-Id: I4151794d8d37177a47a34aef8d83accf4377d44a Pick-to: 6.1 6.2 Reviewed-by: Volker Hilsheimer <volker.hilsheimer@qt.io> Reviewed-by: Alexandru Croitor <alexandru.croitor@qt.io> Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>