summaryrefslogtreecommitdiffstats
path: root/cmake
Commit message (Collapse)AuthorAgeFilesLines
* CMake: Pierce through LINK_ONLY deps in finalizer dep traversalv6.2.0-beta1Alexandru 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 Change-Id: Ifbb91a17d388c3dc4263e17ec0d3bd5627b57cb4 Reviewed-by: Alexey Edelev <alexey.edelev@qt.io> Reviewed-by: Alexandru Croitor <alexandru.croitor@qt.io> (cherry picked from commit 82063d9af1f9ad6cddab4d5526316816cbe1a77c) Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
* 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 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> (cherry picked from commit 19816826873ebb3a89b2173f8685a8d448410680) Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
* 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. Task-number: QTBUG-87989 Change-Id: Icde1e5d31083ce1b6128ab45b0e9df5ae69736a3 Reviewed-by: Alexey Edelev <alexey.edelev@qt.io> Reviewed-by: Joerg Bornemann <joerg.bornemann@qt.io> (cherry picked from commit 8c1a35a991bf655c836060b73f875f565920911a) Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
* CMake: Handle fuzzer-no-link sanitizer feature name correctlyAlexandru Croitor2021-06-251-1/+12
| | | | | | | | | Task-number: QTBUG-87989 Change-Id: Ife42f1fe001c5fafd10981f23dcd387cacc15276 Reviewed-by: Alexey Edelev <alexey.edelev@qt.io> Reviewed-by: Joerg Bornemann <joerg.bornemann@qt.io> (cherry picked from commit 9a9da3aad2e59ed9f1f7e8210a6bd5de741d9e7c) Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
* CMake: Update ECM sanitizer module to latest versionAlexandru Croitor2021-06-252-112/+97
| | | | | | | | | | | | To bring support for sanitizers when using MSVC. 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> (cherry picked from commit 6b3e512e021adf1a51bcf74f885e39d3cf544c18) Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
* 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. Change-Id: Ife0eba61a1aab4f988d9fe7e2217d30eb96774a7 Reviewed-by: Alexey Edelev <alexey.edelev@qt.io> Reviewed-by: Joerg Bornemann <joerg.bornemann@qt.io> (cherry picked from commit e2c6f2ba7ed72195d12e9882c174e59a53317097) Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
* Disable forced full optimization if QT_USE_DEFAULT_CMAKE_OPTIMIZATION_FLAGS=ONAlexey Edelev2021-06-241-0/+5
| | | | | | | | Task-number: QTBUG-94753 Change-Id: Ib9dda1a96f3123394e3b3d4f84feac8cedd18b89 Reviewed-by: Alexandru Croitor <alexandru.croitor@qt.io> (cherry picked from commit 1cb63fcc97e2b114996e25e679b167cb5d392c60) Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
* Fix QT_HOST_DATA for builds setting INSTALL_MKSPECSDIRJoerg Bornemann2021-06-241-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 Change-Id: I2c44cda8405ff1d14391254fcd1d9b1361cb5855 Reviewed-by: Alexandru Croitor <alexandru.croitor@qt.io> (cherry picked from commit d6e01ae05c3695aaf7d0d434718154b6ff151e32) Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
* 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 Change-Id: If66a46d970047fe25582e323df74e0a904ee92da Reviewed-by: Volker Hilsheimer <volker.hilsheimer@qt.io> (cherry picked from commit d0676874d6cb00455e6dc94c519c31aa24e3d276) Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
* Disable -Werror=stringop-overflow on GCC >= 10Giuseppe D'Angelo2021-06-221-0/+8
| | | | | | | | | | | | There's a number of upstream bugs that cause false positives; do not make them errors. Change-Id: I4151794d8d37177a47a34aef8d83accf4377d44a Reviewed-by: Volker Hilsheimer <volker.hilsheimer@qt.io> Reviewed-by: Alexandru Croitor <alexandru.croitor@qt.io> Reviewed-by: Thiago Macieira <thiago.macieira@intel.com> (cherry picked from commit 648e9696d38f9338019d30f297029ba34efb673c) Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
* wasm: fix build for emscripten 2.0.14Lorn Potter2021-06-221-1/+1
| | | | | | | | | new syntax rules for EXTRA_EXPORTED_RUNTIME_METHODS valid after 2.0.16 Change-Id: Iff33e4c6f3176619fb35ec0994a7cc87b5d937c7 Reviewed-by: Morten Johan Sørvig <morten.sorvig@qt.io> (cherry picked from commit ae717aa51f5eabaaa5f272578c63201263e72554) Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
* Cleanup temporary code related to internal modulesAlexey Edelev2021-06-211-9/+1
| | | | | | | | | | Remove the temprotary 'Private' targets of the iternal modules. Task-number: QTBUG-87775 Change-Id: I9a2c7c8c2f63602476fd935b11dab7a835864537 Reviewed-by: Alexandru Croitor <alexandru.croitor@qt.io> (cherry picked from commit 991b64a7e5bd8c46750afe0b7f47aa848ef34ce0) Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
* Move dependency lookup functionality to the common macroAlexey Edelev2021-06-196-51/+35
| | | | | | | | | | | Dependency lookup mechanism is the same for modules and plugins. It makes sense to wrap it using macro. Change-Id: I73727743b0f5f40b2d94624f65ebfcf85e8dcc59 Reviewed-by: Qt CI Bot <qt_ci_bot@qt-project.org> Reviewed-by: Alexandru Croitor <alexandru.croitor@qt.io> (cherry picked from commit ff4244b540e38c31a474ac23dc1b1696f35730ea) Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
* Disable finalizers by default for the non-ld linkersAlexey Edelev2021-06-192-3/+19
| | | | | | | | | | | Check if link order matters before use the object library finalizer. Amends 5fb99e3860eb43f4bacacec7f4a4626cb0159b14 Change-Id: Ie996bc175ebea36ccda1bb2fe388ae3b7fcde395 Reviewed-by: Alexandru Croitor <alexandru.croitor@qt.io> (cherry picked from commit cdbb390c4a9b8d53cfcfd0884e6720423ce5e126) Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
* Fix the naming of the config header files for private modulesAlexey Edelev2021-06-181-4/+11
| | | | | | | | | | | | | | | | | | Perform a file name of the config header before adding a '_private' suffix. TODO: It makes sense to revisit the use of the CONFIG_MODULE_NAME variable since the variable is used for different purposes and mutate with use. Amends 8aee7c6b29be5a0ee7d5e7cfcb5f2db762b2e28b Fixes: QTBUG-94568 Change-Id: Id5aaf8d423ec8b94afffe4641b54dab94b5453fb Reviewed-by: Shawn Rutledge <shawn.rutledge@qt.io> Reviewed-by: Alexandru Croitor <alexandru.croitor@qt.io> (cherry picked from commit ed92cb30e465c1dad704bd268646a4a69b1d448c) Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
* Move the linking logic of the object libraries to a common functionAlexey Edelev2021-06-181-38/+40
| | | | | | | | | | | | | | | | | | | | The linking logic of object libraries should be reusable outside of the resource context. This introduces a __qt_internal_propagate_object_library function that prepares all the necessary genexes to link and propagate the object library to the end-point executable. Rename resource object finalizer API to make the naming more generic to object libraries of any kind. Amends 5fb99e3860eb43f4bacacec7f4a4626cb0159b14 Task-number: QTBUG-93002 Task-number: QTBUG-94528 Change-Id: I69d0f34c0dadbd67232de91035aaa53af93d1fa1 Reviewed-by: Alexandru Croitor <alexandru.croitor@qt.io> (cherry picked from commit 3329212815777e33dfb4697b748d10927d73f44c) Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
* Add GCC 11 and C++20 workaroundsGiuseppe D'Angelo2021-06-181-0/+11
| | | | | | | | | | | | | | | | | | | | | | GCC 11.1 has a bug [1] in the preprocessor that leads to -Wsuggest-override warnings being raised in random places, even under pragmas that are supposed to suppress it. For some reason, NOT using the integrated preprocessor fixes it, so add that flag as a workaround. Also, GCC 11 introduces a family of warnings for C++20's deprecations of mixed enum arithmetic, which we use all over the place. Avoid a hard error for those warnings. [1] https://gcc.gnu.org/bugzilla/show_bug.cgi?id=100796 Change-Id: I3b2aefa385f191f207e7eb876bc1ed0b18fb342b Task-number: QTBUG-93360 Task-number: QTBUG-94059 Reviewed-by: Fabian Kosmale <fabian.kosmale@qt.io> Reviewed-by: Jarek Kobus <jaroslaw.kobus@qt.io> Reviewed-by: Edward Welbourne <edward.welbourne@qt.io> (cherry picked from commit f29ff5dffb7f9321d2bfb6071813d2d8d88186b3) Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
* Use target OUTPUT_NAME as a module identifier in .pri filesAlexey Edelev2021-06-181-3/+1
| | | | | | | | | | | | | | | QtPriHelpers copies the logic related to the module OUTPUT_NAME to produce a module identifier. Since the module identifier should be equal to OUTPUT_NAME it makes sense to reuse the property and deduplicate logic. Amends 8aee7c6b29be5a0ee7d5e7cfcb5f2db762b2e28b Fixes: QTBUG-94568 Change-Id: I8d9c04273e4cdb1a2e6a3b0db3ddf52e008c0cf7 Reviewed-by: Alexandru Croitor <alexandru.croitor@qt.io> (cherry picked from commit 29789ff0eabc2ea91a21526c475e5a8c0126a7af) Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
* CMake: Handle OPTIONAL_COMPONENTS in qt_find_packageAlexandru Croitor2021-06-185-3/+37
| | | | | | | | | | | | | | | | | | | The optional components arguments were not handled before which caused the recorded package information for static builds to be incorrect, it only recorded the package name without the component. Remove REQUIRED_COMPONENTS TODO, there is no such find_package option, it's already handled by the regular COMPONENTS code path. Amends 07b6d3367debd8f15974abf0f5cdf48f0fe3a536 Fixes: QTBUG-94501 Change-Id: Ib48a7befcb70e20c3f21315897d51d3064b48134 Reviewed-by: Qt CI Bot <qt_ci_bot@qt-project.org> Reviewed-by: Dominik Holland <dominik.holland@qt.io> Reviewed-by: Joerg Bornemann <joerg.bornemann@qt.io> (cherry picked from commit b6c5e0667696c1d4abaf37f2224b2121b72cdebd) Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
* Fix internal module naming in qmake .pri filesAlexey Edelev2021-06-172-1/+3
| | | | | | | | | | | | | | Set the correct value to the _qt_config_module_name property at the internal module creating step instead of appending _private suffix when generating .pri files. Amends 425ff34aa10a02524f2d52f544dc00b539ef9a26 Fixes: QTBUG-94568 Change-Id: I6fa8089358bc638668e313c98c3aee680bf7ec2a Reviewed-by: Alexandru Croitor <alexandru.croitor@qt.io> (cherry picked from commit 8aee7c6b29be5a0ee7d5e7cfcb5f2db762b2e28b) Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
* CMake: Export info if an object lib target is a plugin initializerAlexandru Croitor2021-06-171-0/+5
| | | | | | | | | | | | | Needed for qtdeclarative so we can filter out which object library should go into which export set, because qt_internal_add_qml_module can create both a backing library export set and a plugin export set. The plugin initializer object lib should go to the plugin export set. Task-number: QTBUG-92933 Change-Id: I0fce131eff75a0b3090ac0fbb2a12ecfcba5e38d Reviewed-by: Joerg Bornemann <joerg.bornemann@qt.io> (cherry picked from commit 5ec937115bc677a75525dfa9147c1763adbea50e) Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
* CMake: Add TODO to apply generalized object library linking approachAlexandru Croitor2021-06-171-0/+3
| | | | | | | Change-Id: I1ea368e81d8b055ef353a0f021f188b45588c937 Reviewed-by: Joerg Bornemann <joerg.bornemann@qt.io> (cherry picked from commit a37957df5c1d3d8624fae2222734a127ec340a72) Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
* CMake: Set the plugin class name for qml pluginsAlexandru Croitor2021-06-171-2/+24
| | | | | | | | | | | | | | | | | | | | | | | | | | This is needed for a change in qtdeclarative to allow building the Q_IMPORT_PLUGIN-containing object library initializer of a qml plugin. Show an error if the qml plugin has no class name, it's needed for plugin initialization so it's mandatory to have a class name. Show an error if a class name is not found when computing the import macro for a plugin (both for a regular qt plugin and a qml plugin). When querying for the class name of a target, query both a Qt6:: prefixed target as well as a non-prefixed one, with the Qt one taking precedence. This is to allow querying the class name of user project created qml plugins. Currently regular qt user plugins don't use the object library initializer approach. This will likely be revisited in the future. Task-number: QTBUG-92933 Change-Id: I46417471a7d8b49651e6821f7b28e7a9d44c2557 Reviewed-by: Joerg Bornemann <joerg.bornemann@qt.io> (cherry picked from commit 602d26c38f3767be9bec25302c93fc155c4dce59) Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
* CMake: Don't generate .pri files for qml pluginsAlexandru Croitor2021-06-171-1/+5
| | | | | | | | | | | | | | | | | | We didn't do it in Qt 5 times and it was accidentally done for Qt 6. There's no reason to generate them, the .pri files are only meant to be used for regular plugins so a project can do QTPLUGINS += foo. That mechanism is not needed for qml plugins which use qmlimportscanner instead. Furthermore the pri contents didn't contain a class name, so they couldn't be used anyway. Change-Id: I6299fda21ece0f693a817ab558b45aa46b97e5ee Reviewed-by: Joerg Bornemann <joerg.bornemann@qt.io> (cherry picked from commit 103c1bc7baf29dbc93fdffc81586c83225eeef1c) Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
* Remove target specific flags from the linker capabilities checkAlexey Edelev2021-06-179-186/+20
| | | | | | | | | | | | | Remove target specific flags from static_link_order. Move the check to the common config.tests folder. Amends 5fb99e3860eb43f4bacacec7f4a4626cb0159b14 Task-number: QTBUG-93002 Task-number: QTBUG-94528 Change-Id: I1368075ec6bd1e743b2b89fd93143df38a278ec2 Reviewed-by: Alexandru Croitor <alexandru.croitor@qt.io> (cherry picked from commit 13a4de6bf65d29a808ecd94b382ac0c1add9e0b3)
* Check the impact of static link order for user projectsAlexey Edelev2021-06-175-33/+122
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | For user projects we run the static link order check once 'find_package(Qt6 ...)' is called. If linker can resolve circular dependencies between static libraries and object files we set the _qt_link_order_matters property of the Qt::Platform target. This indicates the use of finalizers is not required and we may rely on CMake-base propagation of resource libraries and resource object files. If linker could not resolve circular dependencies depending on the _qt_resource_objects_finalizer_mode value: - Finalizer will be called and collected resource objects will be linked to the target directly. - Finalizer will be omitted and resource objects will be linked using the target_sources function implicitly. This only propagates resource one level up if consumer links the static library PUBLICly, but all symbols will be resolved correctly since object files are placed in the beginning of the linker line. In the CMake version 3.21 we expect that CMake will take care about the order of the resource object files in a linker line, it's expected that all object files are located at the beginning of the linker line. TODO: Need to confirm that the CMake 3.21 meets the expectations. Amends 4e901a2f99cbfda3b479253ea54b16f02e1c3aa5 Task-number: QTBUG-93002 Task-number: QTBUG-94528 Change-Id: Ia68976df8182d3d3007b90c475c1e3928a305339 Reviewed-by: Alexandru Croitor <alexandru.croitor@qt.io> (cherry picked from commit 5fb99e3860eb43f4bacacec7f4a4626cb0159b14)
* CMake: Don't make example external projects depend on testsAlexandru Croitor2021-06-161-2/+12
| | | | | | | | | | | | | | | | | | | Only depend on the ${project}_src and ${project}_tools targets. This might exclude some non-obivous target dependencies, but we can adjust that if needed. This reduces the build.ninja file of qtbase + qtsvg form 341MB to 41MB when configuring with tests and examples, as well as reduces the processing time of calling ninja. Amends d97fd7af2bc5c89a0ad9e5fac080041b78d01179 Change-Id: I2860d8ae89728f33f6b73fede1335cd6d6290f78 Reviewed-by: Morten Johan Sørvig <morten.sorvig@qt.io> Reviewed-by: Tor Arne Vestbø <tor.arne.vestbo@qt.io> (cherry picked from commit 335123f240c0b59cc62ad151dcf185160ef33696) Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
* CMake: Promote all targets to global within a scope when possibleAlexandru Croitor2021-06-163-3/+39
| | | | | | | | | | | | | | | | | | | | | | | | | CMake 3.21 introduced a new IMPORTED_TARGETS directory property which we can use to promote all imported targets within a scope to be global. This would cover transitive non-Qt imported targets which the Qt build system does not know about and is thus a more complete solution compared to promoting only Qt targets. Run a finalizer at the end of the directory scope where find_package(Qt6) is called to promote all imported targets within that scope to global (when requested). The old promotion method is disabled when the CMake version is new enough. Task-number: QTBUG-92878 Task-number: QTBUG-94528 Change-Id: I533a3bd4186eba652f878ddd72c76118c2fd8bae Reviewed-by: Alexey Edelev <alexey.edelev@qt.io> Reviewed-by: Joerg Bornemann <joerg.bornemann@qt.io> (cherry picked from commit 7f0f44f014c3ae211516fb2736401b8497dd426a) Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
* CMake: Allow promoting the Qt libraries to be global targetsAlexandru Croitor2021-06-168-17/+154
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | User projects can set the QT_PROMOTE_TO_GLOBAL_TARGETS variable to true so that the various imported targets created by find_package(Qt6) are promoted to global targets. This would allow a project to find Qt packages in a subdirectory scope while using those Qt targets from a different scope. E.g. it fixes errors like CMake Error at CMakeLists.txt:5 (target_link_libraries): Error evaluating generator expression: $<TARGET_OBJECTS:Qt6::Widgets_resources_1> Objects of target "Qt6::Widgets_resources_1" referenced but no such target exists. when trying to use a static Qt from a sibling scope. Various 3rd party dependency targets (like Atomic or ZLIB) are not made global due to limitations in CMake, but as long as those targets are not mentioned directly, it shouldn't cause issues. The targets are made global in the generated QtFooAdditionalTargetInfo.cmake file. To ensure that resource object libraries promoted, the generation of the file has to be done at the end of the defining scope where qt_internal_export_additional_targets_file is called, which is achieved with a deferred finalizer. Replaced all occurrences of target promotion with a helper function which allows tracing of all promoted targets by specifying --log-level=debug to CMake. Fixes: QTBUG-92878 Change-Id: Ic4ec03b0bc383d7e591a58c520c3974fbea746d2 Reviewed-by: Alexey Edelev <alexey.edelev@qt.io> Reviewed-by: Qt CI Bot <qt_ci_bot@qt-project.org> Reviewed-by: Joerg Bornemann <joerg.bornemann@qt.io> (cherry picked from commit 561fc8107f38b93808343e35c62d7d06704f8eb6) Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
* Detect win32-msvc targetAllan Sandfeld Jensen2021-06-151-0/+3
| | | | | | | | | Automatically set compilers based on old mkspec style target Change-Id: I80404376964a85c6b519657c054d008da47aed91 Reviewed-by: Joerg Bornemann <joerg.bornemann@qt.io> (cherry picked from commit b62fcccb1560698dddbf5167813ae1dc044fc35b) Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
* Fix the win32-clang-msvc targetAllan Sandfeld Jensen2021-06-154-3/+10
| | | | | | | | | Detect clang-cl mkspec target Change-Id: If0ca31ae2da3b44a4e2bd116933007139cc02fdc Reviewed-by: Joerg Bornemann <joerg.bornemann@qt.io> (cherry picked from commit 127f658cc9fee2729664674dc17fcc695544ce7d) Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
* Adjust the EntryPoint target name according to the internal module naming policyAlexey Edelev2021-06-152-9/+10
| | | | | | | | Task-number: QTBUG-87775 Change-Id: I1d6097c950f97e102c44e2952edc98caa4deb6c6 Reviewed-by: Alexandru Croitor <alexandru.croitor@qt.io> (cherry picked from commit 02855ff6e076d04b7ae748c2485f1e098c32d698) Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
* CMake: Add public FindPackageHelpersDominik Holland2021-06-155-4/+6
| | | | | | | | | | This makes qt_internal_disable_find_package_global_promotion available, which is needed when linking against QtMultimedia in a static build Change-Id: I9b8f6d7b74a8693ac471f8a280e893f4da80a44b Reviewed-by: Alexandru Croitor <alexandru.croitor@qt.io> (cherry picked from commit f380c87731472eb59495b7823b7c6243b3aa11f4) Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
* cmake: Allow tools to enable exceptionsRobert Griebl2021-06-141-1/+7
| | | | | | | | | | | Needed for the QtApplicationManager tools. Change-Id: I987b297406b6659d777ce5c00f9fc1b89ccc80ab Reviewed-by: Alexandru Croitor <alexandru.croitor@qt.io> Reviewed-by: Alexey Edelev <alexey.edelev@qt.io> Reviewed-by: Joerg Bornemann <joerg.bornemann@qt.io> (cherry picked from commit 6eea6e30c601a8864bfbb38fc063c536f243d991) Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
* Replace flags with spaces when removing themAlexey Edelev2021-06-111-2/+2
| | | | | | | | | | | | Removing flags based on REGEX may include spaces, so flags might be glued. Replace flags with spaces to keep at least one space for the described case. Fixes: QTBUG-94400 Change-Id: Ice268da36174ef5cf4398d2aee8fcd4731336316 Reviewed-by: Joerg Bornemann <joerg.bornemann@qt.io> (cherry picked from commit 523ee5577a3fb1801dc765511c2c76753c10a72e) Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
* Add the check for linker capabilities to resolve circular dependenciesAlexey Edelev2021-06-108-2/+202
| | | | | | | | | | | | | | | 'ld' only capable to resolve circular dependencies by wrapping the suspected static libraries and objects using --start/end-group arguments. We want to detect if linker is 'ld' at configure time to decide how to link the resource objects if finalizers are not enabled. The qt_config_compile_test function is extended with an extra argument since it's required to pass custom cmake flags to the ld-related test. Change-Id: I484fcc99e2886952d8b0232f37e4e6a35d072931 Reviewed-by: Alexandru Croitor <alexandru.croitor@qt.io> (cherry picked from commit 4e901a2f99cbfda3b479253ea54b16f02e1c3aa5) Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
* CMake: Fix global 'apk' target to apply to Qt EXTERNAL_BUILD examplesAlexandru Croitor2021-06-081-0/+17
| | | | | | | | | | | This means calling 'ninja apk' in a Qt build with examples configured will build all example apks, regardless of whether the examples are built as external projects or in-tree. Fixes: QTBUG-94264 Change-Id: I5c7af0354858898a2e154a6d54fb025e4d81ff80 Reviewed-by: Joerg Bornemann <joerg.bornemann@qt.io> Reviewed-by: Qt CI Bot <qt_ci_bot@qt-project.org>
* wasm: fix threaded buildsLorn Potter2021-06-081-2/+4
| | | | | | | set the thread pool size default to 4 Change-Id: I038a81610c82ac4d162c044d0e1f58196cffc7b7 Reviewed-by: Morten Johan Sørvig <morten.sorvig@qt.io>
* CMake: Add support for building with clang-clCristian Adam2021-06-042-2/+4
| | | | | | | | | qmake had support for building with clang-cl as the win32-clang-msvc mkspec. Task-number: QTBUG-89642 Task-number: QTBUG-88081 Change-Id: I0709c289f90fedb121620d1e67ef841602219816 Reviewed-by: Alexandru Croitor <alexandru.croitor@qt.io>
* Remove CMake compatibility functions for old APIJoerg Bornemann2021-06-043-114/+0
| | | | | | | | | All repositories define QT_NO_INTERNAL_COMPATIBILITY_FUNCTIONS by now, and we can remove QtCompatibilityHelpers.cmake altogether. Change-Id: I4d8104246e96a4514d5651c104607d651d208d95 Reviewed-by: Qt CI Bot <qt_ci_bot@qt-project.org> Reviewed-by: Alexandru Croitor <alexandru.croitor@qt.io>
* Fix support for using system supplied md4c libraryNiclas Rosenvik2021-06-031-0/+24
| | | | | | | | | | | | | | | | | | | Add FindWrapSystemMd4c.cmake so that the old md4c target can be used as well as the new one and set WrapSystemMd4c_FOUND. Link to the imported target WrapSystemMd4c::WrapSystemMd4c if the system library is used. Add qt_find_package line to find the package in configure.cmake. Fix the condition for enabling system-textmarkdownreader, it includes testing for textmarkdownreader because even if the code would compile correctly without it, it looks strange when the output says "textmarkdownreader no" and under "using system libmd4c yes" even if libmd4c is not used. Use system include when system-markdownreader is enabled. Add library mapping for libmd4c. Change-Id: Id5d5b13d6691a8c1cdf627238887977c847c1e67 Reviewed-by: Shawn Rutledge <shawn.rutledge@qt.io> Reviewed-by: Alexandru Croitor <alexandru.croitor@qt.io>
* Move resource object files to the beginning of linker line in .prl filesAlexey Edelev2021-06-031-1/+1
| | | | | | | | | Move collected resource objects to the beginning of the linker line to prevent order-related issues. Fixes: QTBUG-92250 Change-Id: Ia046f2820feb693bfadc2b60e07fa001638d4d7b Reviewed-by: Alexandru Croitor <alexandru.croitor@qt.io>
* Fix location of qtattributionsscanner in doc buildsKai Köhne2021-06-031-6/+9
| | | | | | | | qtattributionsscanner is now found in libexec. Task-number: QTBUG-88791 Change-Id: Ie704663012be92b0c223d9d57210ec1874abff0b Reviewed-by: Joerg Bornemann <joerg.bornemann@qt.io>
* Make framework names consistent with the module namesAlexey Edelev2021-06-034-18/+25
| | | | | | | | | | | | | | | | | | For Apple's frameworks it's possible to include header files using the following assumption: If the framework name is "MyFramework" then '#include <MyFramework/frameworkheader.h>' will work without specifying the include path explicitly. This is broken for internal modules since they use the framework name with the 'Private' suffix. This uses the module name instead of the target name as a framework name. Amends edbe0eb335ca4c0fde23f57eae5acdf80937c9e3 Task-number: QTBUG-87775 Change-Id: I0592a28d0768724b6e10ca81aa7cefb0a3699a5e Reviewed-by: Alexandru Croitor <alexandru.croitor@qt.io>
* Collect resource objects of plugins and their dependencies in finalizerAlexey Edelev2021-06-031-2/+32
| | | | | | | | | | | | | Resource objects might be linked to plugins. Since some plugins may be present in LINK_LIBRARIES as the complex genexes, need to collect them explicitly and iterate over plugin targets to find resource object libraries that need to be exposed to end-point target executable. Amends a1fd4f51ada82854f35654158a334454e760a9f7 Change-Id: Icd85f54f7bf9d1b7e3382caa5d9aa62449b6adb8 Reviewed-by: Lorn Potter <lorn.potter@gmail.com> Reviewed-by: Alexandru Croitor <alexandru.croitor@qt.io>
* CMake: Explicitly generate static plugin helpers into binary dirUlf Hermann2021-06-031-2/+2
| | | | | | | Before, it would erroneously look for them in the source directory. Change-Id: I6dcd3ccde3e57dba84639da2cd354c51e8a92459 Reviewed-by: Alexandru Croitor <alexandru.croitor@qt.io>
* CMake: Fix generated prl and pri files for MSVCLi Xinwei2021-06-025-5/+33
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | In MSVC static build, if we build Qt with 3rdparty library (e.g. zstd), cmake will add"zstd" (without "-l" prefix) to Qt6Core.prl. Then we use this Qt to build a qmake project, compilation will fail due to missing zstd.obj. Without "-l" prefix, qmake will treat "zstd" as an object file instead of a library. Library names in qt_module.pri and qt_lib_*_private.pri are also missing "-l" prefix. This is because on most compilers, CMAKE_LINK_LIBRARY_FLAG equals "-l". But on MSVC, it is an empty string. So we should pass "-DLINK_LIBRARY_FLAG=-l" for MSVC. Also add "-L/path/to/library" if the library path is not in default linker search directories. This will write un-relocatable paths to prl files only when using 3rdparty libraries to build Qt statically. Usually it's not a problem. In addition, CMAKE_CXX_IMPLICIT_INCLUDE_DIRECTORIES is also empty on MSVC. So The third argument of "$<FILTER>" is empty, it is an invalid generator expression. This means no include dir will be written to qt_module.pri and qt_lib_*_private.pri on MSVC. So only use "$<FILTER>" when CMAKE_CXX_IMPLICIT_INCLUDE_DIRECTORIES is not empty. Pick-to: 6.1 Change-Id: Ib66f95dc09cf920363a4b9338fb97747dd2f8ab7 Reviewed-by: Qt CI Bot <qt_ci_bot@qt-project.org> Reviewed-by: Alexandru Croitor <alexandru.croitor@qt.io>
* Fix EXTRA_CMAKE_FILES behavior of qt_internal_add_toolJoerg Bornemann2021-06-011-9/+24
| | | | | | | | | | | | | ...and make it consistent with that of qt_internal_add_module. Make EXTRA_CMAKE_FILES a multi value keyword. Do not add include statements for every file in EXTRA_CMAKE_FILES. Add the EXTRA_CMAKE_INCLUDES argument to specify includes. This enables us to specify EXTRA_CMAKE_FILE that are not included. Change-Id: I1a3667473b94ee44363b554ab9e6c380e5c11389 Reviewed-by: Alexandru Croitor <alexandru.croitor@qt.io>
* Pass OpenGL_GL_PREFERENCE variable to other Qt reposJoerg Bornemann2021-06-011-0/+8
| | | | | | | | | | | | | | When building Linux packages, we pass OpenGL_GL_PREFERENCE=LEGACY when building qtbase. This is done to link against legacy OpenGL libs. When building non-qtbase repos, we also need to set this variable to the same value we have in qtbase. Pick-to: 6.1 Task-number: QTBUG-89754 Fixes: QTBUG-94040 Change-Id: I567b629d245025d2b1544b91cfc265a9c921725f Reviewed-by: Alexandru Croitor <alexandru.croitor@qt.io>
* Do not get LINK_LIBRARY of the interface librariesAlexey Edelev2021-06-011-1/+7
| | | | | | | | | | Avoid getting the LINK_LIBRARY property of the interface libraries when calling a resource object finalizer. Amends a1fd4f51ada82854f35654158a334454e760a9f7 Change-Id: I19d625a927c66994902f5c89e6c82183c94af91e Reviewed-by: Alexandru Croitor <alexandru.croitor@qt.io>