summaryrefslogtreecommitdiffstats
path: root/cmake
Commit message (Collapse)AuthorAgeFilesLines
* Make qt_get_module_for_plugin() internal and do what its name saysCraig Scott2021-03-101-12/+7
| | | | | | | | | | | | | | | | | | | Contrary to its name, this command was also setting a target property. Since it was only called in one place and that caller can just as easily set the property instead, rename the command to make clear its internal nature and refactor it so that the caller is responsible for setting that property instead. Also make it an error rather than just a warning if the command is used for a target that doesn't belong to any module. Since this is now unambiguously an internal command, we should always expect the target to belong to a module. Change-Id: I929a652ddd482653868fc9df887f38f4bc7f35d9 Reviewed-by: Ulf Hermann <ulf.hermann@qt.io> Reviewed-by: Joerg Bornemann <joerg.bornemann@qt.io> (cherry picked from commit c6bbca748659468b99002ec4b71559c65963b950) Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
* configure: Fix error when turning on/off non-emitted featuresJoerg Bornemann2021-03-091-14/+14
| | | | | | | | | | | | | | | | | | Features that are not emitted in the current configuration (e.g. plugin-manifests on Linux) should not yield an error. Instead, print a warning message like Qt5's configure did. Set insignificant feature to OFF. Remove the now unneeded emit_if parameter from qt_feature_set_cache_value. Fixes: QTBUG-88305 Change-Id: I0f2ce152fca5f08417038c9bd2c07639ff6a3df4 Reviewed-by: Alexey Edelev <alexey.edelev@qt.io> Reviewed-by: Alexandru Croitor <alexandru.croitor@qt.io> (cherry picked from commit c4f5762b20dc20bab3cc62e9166d0e5b36e21cc6) Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
* Move syncqt.pl to libexecJoerg Bornemann2021-03-091-5/+1
| | | | | | | | | | | | | | To not disturb the qmake build we kept syncqt.pl in <src>/bin but installed it to libexec. This is not necessary anymore. This also removes the need for having syncqt.pl in both, bin and libexec in the build dir of qtbase. Fixes: QTBUG-91076 Change-Id: I44b014ea41e3f00c420e02fd5c76f11169340b8c Reviewed-by: Kai Koehne <kai.koehne@qt.io> (cherry picked from commit 800f7451406d58910568854deb4dbebbca0ee6d4) Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
* Complete the renaming of qt_add_tool to qt_internal_add_toolJoerg Bornemann2021-03-071-3/+3
| | | | | | | | | | | Fix the name in the function's doc comment and error messages. Change-Id: I918db802a0dbb0508f65d227f7c896d2ad0beeae Reviewed-by: Alexey Edelev <alexey.edelev@qt.io> Reviewed-by: Craig Scott <craig.scott@qt.io> Reviewed-by: Cristian Adam <cristian.adam@qt.io> (cherry picked from commit 728baba70a389dd13411819a4ec5db6004fb1e97) Reviewed-by: Fabian Kosmale <fabian.kosmale@qt.io>
* Generate information about user-facing applications in build dirJoerg Bornemann2021-03-074-1/+33
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | When packaging different Qt versions for Linux distributions (or any distribution with a common bin dir), Qt tools cannot be installed to /usr/bin, because the executable names of the different Qt versions clash. To solve this conflict, our recommendation is to install Qt's tools to /usr/lib/qt6/bin and to create versioned symlinks to user-facing tools in /usr/bin. User-facing tools are tools that are supposed to be started manually by the user. They are marked in Qt's build system. Distro package maintainers can now configure with -DCMAKE_INSTALL_PREFIX=/usr -DINSTALL_BINDIR=/usr/lib/qt6/bin -DINSTALL_PUBLICBINDIR=/usr/bin and will find a file called user_facing_tool_links.txt in the build directory after the cmake run. Nothing will be installed to INSTALL_PUBLICBINDIR. Each line of user_facing_tool_links.txt consists of the installation path of a user-facing application followed by a space and the versioned link name in INSTALL_PUBLICBINDIR. Example content: /usr/lib/qt6/bin/qmake /usr/bin/qmake6 To actually create the versioned symlinks, the content of this file can be fed to ln like this: xargs ln -s < build-dir/user_facing_tool_links.txt Or the package maintainer may decide to do something completely different as suits their needs. This patch adds the USER_FACING argument to qt_internal_add_tool to mark tools as user-facing. In addition, every Qt created by qt_internal_add_app is treated as user-facing. The only tool this patch marks as user-facing in qtbase is qmake. Fixes: QTBUG-89170 Change-Id: I52673b1c8d40f40f56a74203065553115e2c4de5 Reviewed-by: Kai Koehne <kai.koehne@qt.io> Reviewed-by: Shawn Rutledge <shawn.rutledge@qt.io> (cherry picked from commit b1ad7f938e2f71288e65a8c9a86b732b89a6a345) Reviewed-by: Fabian Kosmale <fabian.kosmale@qt.io>
* Avoid cyclic dependency between plugin and module *Config.cmake filesCraig Scott2021-02-251-1/+1
| | | | | | | | | | | | | | | | | | | | | | | | | | | In static per-repo builds, we have a mix of targets provided by packages and targets provided by the main build. For the builds that create the packages, we must avoid adding a dependency for the main module library target on its associated plugin targets or else the package config files end up with a cyclic dependency that cannot be resolved when something tries to consume them. This only happens for static builds because we have been attaching a linking relationship to the main module library that isn't really a true dependency, we attached it only for convenience of things linking to that module library. To preserve that convenience linking without breaking the config packages, we use the QT_NO_CREATE_TARGETS condition to prevent CMake seeing that relationship when generating the *Config.cmake files. Creating these relationships will be delayed until the plugin's *Config.cmake file is loaded, at which point it will add itself to the main module library's imported target INTERFACE (this was already done before, we just now rely solely on that). Task-number: QTBUG-90819 Change-Id: Id725742182bcda64841be84fe1650bafb9151bb1 Reviewed-by: Joerg Bornemann <joerg.bornemann@qt.io> (cherry picked from commit be7e20213cc34d6ab23d3db938c6b9317034c9d7) Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
* CMake: Prevent qt_remove_args() from accessing out-of-range list indexCraig Scott2021-02-241-0/+4
| | | | | | | Change-Id: Ie9c5f0551722c7d3fb11879b209c11ce3d7ccd6d Reviewed-by: Kai Koehne <kai.koehne@qt.io> (cherry picked from commit 10b3681c72491cacf9ccf515fa2cbdf2ef131ff9) Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
* cmake: Don't give plugins PUBLIC usage requirementsCraig Scott2021-02-241-0/+17
| | | | | | | | | | | | | | | | | | | | | | | | | | | | The pro2cmake.py conversion script faithfully reproduced the .pro files for the plugins, which specified the libraries as public. But in CMake, the implications of this are that public usage requirements should then be propagated to consumers. We don't expect any consumers, since a plugin is created as a MODULE library in CMake, so for Windows we don't even have an import library to link with. The only exception to this is for static builds where plugins are created as STATIC libraries instead, but only in certain controlled situations do we then link to plugins. Even then, usage requirements are not expected to propagate to the consumers, so these relationships should always be specified as private. This change warns on any PUBLIC usage requirements specified for a plugin. This check is disabled by default to avoid spamming CI builds for repos that haven't been fixed yet. The check can be enabled by a CMake cache option, which is intended for developers to use locally when fixing this issue in other repos (all plugins in qtbase should not trigger this warning as a result of changes in this commit). Task-number: QTBUG-90819 Change-Id: I09f2c8da77db1193ad3370f85d367dfc6ab7b9a6 Reviewed-by: Qt CI Bot <qt_ci_bot@qt-project.org> Reviewed-by: Joerg Bornemann <joerg.bornemann@qt.io> (cherry picked from commit fe29159aad0e03ca5eebabf910c90f279b222d03) Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
* CMake: Reformat shared keyword listsCraig Scott2021-02-241-12/+63
| | | | | | | | | | | | | Putting each keyword on its own line makes it much easier to read and improves maintainability. It is friendlier to source control when keywords need to be added or removed. This commit introduces no functional change. Change-Id: I79efd039e5afa5f11f1d859405d6487ad6b3beb2 Reviewed-by: Joerg Bornemann <joerg.bornemann@qt.io> (cherry picked from commit 844e37ca397d0c57d39c06503eba601159f9dfd4) Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
* Move build tools to libexec instead of the bin dirJoerg Bornemann2021-02-231-1/+1
| | | | | | | | | | | | | | | [ChangeLog][Build System] Tools that are called by the build system and are unlikely to be called by the user are now installed to the libexec directory. This is a step towards easier co-installability of different Qt versions. Task-number: QTBUG-88791 Change-Id: Id19575b5ba27795f7715e4ea6a09391b26dd4942 Reviewed-by: Kai Koehne <kai.koehne@qt.io> (cherry picked from commit 1f30bcf33618ca39c47dc1058529b55635e30aef) Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
* Coin: remove workarounds to allow running Android testsAssam Boudjelthia2021-02-181-2/+0
| | | | | | | | | | | | | | We had two workarounds: * script that adds Gui to tests * create a symbolic link for the qt install dir to fake_prefix which androiddelployqt was expecting them to be under Both issues are fixed, thus removing the workarounds. Change-Id: Ic022bece15afe92c693d573893d260b13b4227ed Reviewed-by: Heikki Halmet <heikki.halmet@qt.io> (cherry picked from commit bcbdbd50fefd90cc8cfe2c01d8f681dfe690971a) Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
* CMake: handle Android features dependencies for modulesAssam Boudjelthia2021-02-181-0/+19
| | | | | | | | | | | | QMake used to allow retrieving the Android features list for a modules. The dependencies are written to *-android-dependencies.xml files and are read by androiddeployqt. This option was missed at some point along the way of writing CMake port for Qt 6. Change-Id: Ic0b82f024567e640968f97aeff2db1888f2b53a5 Reviewed-by: Joerg Bornemann <joerg.bornemann@qt.io> (cherry picked from commit 09fc4f9525740b8c671c036413153d3419750b99) Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
* qmake: Introduce QT_HOST_LIBEXECS propertyJoerg Bornemann2021-02-181-0/+1
| | | | | | | | | | This will be used to access host tools that are installed in ${prefix}/libexec instead of ${prefix}/bin. Change-Id: I36c4b5736330f8229d267a117c65d55cd5e12758 Reviewed-by: Kai Koehne <kai.koehne@qt.io> (cherry picked from commit edd122548940a0213e35d11649566efbef7f1fea) Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
* Do not rewrite boolean INPUTs if they have a corresponding featureAlexey Edelev2021-02-181-12/+0
| | | | | | | | | | | | | | | | | | | Initial replacement of boolean INPUT_ variables to the FEATURE_ variables was wrongly changed to updating of the INPUT_ variable value to ON/OFF value. This causes potential issues when INPUT_ variable has explicit check for 'yes' or 'no'. The feature evaluation step enables FEATURE_ variables in case if the corresponding INPUT_ variable contains a positive CMake value. So there is no need to process boolean INPUTs at the argument processing step. Also no need to keep the special opengl case, since it will be processed correctly. Fixes: QTBUG-91158 Change-Id: I96bb7903a904ae3cf788d7ef7d4e0c019046eb95 Reviewed-by: Joerg Bornemann <joerg.bornemann@qt.io> (cherry picked from commit 530b62934923070b5b8b5c5b3c764a2b7d4db039) Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
* Document more arguments of qt_internal_add_toolJoerg Bornemann2021-02-151-0/+6
| | | | | | | | Change-Id: Ia89922bb7d8ce327ea864889f5e2132427c58be6 Reviewed-by: Alexey Edelev <alexey.edelev@qt.io> Reviewed-by: Kai Koehne <kai.koehne@qt.io> (cherry picked from commit a63f72d442df201065efbe6868f669a5855aa557) Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
* Prepare installation of tools to libexecJoerg Bornemann2021-02-151-6/+19
| | | | | | | | | | | | | Add the INSTALL_DIR argument to qt_internal_add_tool to allow installation of tools in other locations than INSTALL_BINDIR. Task-number: QTBUG-88791 Change-Id: I88ede81a4c13c82f6d209156d3801ce130f8fc10 Reviewed-by: Alexey Edelev <alexey.edelev@qt.io> Reviewed-by: Craig Scott <craig.scott@qt.io> Reviewed-by: Kai Koehne <kai.koehne@qt.io> (cherry picked from commit c1cbfcb38fc3aac01da8d32cb8607fad76210e29) Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
* Android: set minimum recommended android SDK to 29Assam Boudjelthia2021-02-131-1/+1
| | | | | | | | | | | | comply with the api version used by default with androiddeployqt and in docs. Google play also requires api 29 as minimum. Task-number: QTBUG-90943 Change-Id: I05e2a90b4d7f2120b0198e3fb7b8b1b2398eba93 Reviewed-by: Ville Voutilainen <ville.voutilainen@qt.io> Reviewed-by: BogDan Vatra <bogdan@kdab.com> (cherry picked from commit e711eb35f54cabf8b0beff49e5b748731d042c63) Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
* configure: Don't guess the compiler if the user already chose oneJoerg Bornemann2021-02-111-4/+41
| | | | | | | | | | | | | We must not guess the compiler from the -platform argument if one of the following holds: - the CXX/CC environment variables are set - the CMAKE_CXX_COMPILER/CMAKE_C_COMPILER variables are passed Fixes: QTBUG-90914 Change-Id: Iff7a0e7b8857f77333f1705f118d7952af5234ba Reviewed-by: Cristian Adam <cristian.adam@qt.io> (cherry picked from commit 41e3d167d5e1dede286e6960037c5ac115eb692f) Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
* CMake: setup windows tools path only when building on WindowsSamuli Piippo2021-02-111-1/+1
| | | | | | | | | | | | Fix cross-compilation on Linux host. Task-number: QTBUG-91052 Change-Id: I48c970f0e6af71e3eda3818557e764f60d3836ad Reviewed-by: Juha Vuolle <juha.vuolle@insta.fi> Reviewed-by: Ulf Hermann <ulf.hermann@qt.io> Reviewed-by: Joerg Bornemann <joerg.bornemann@qt.io> (cherry picked from commit 24d2215b67e1875046aa8c856751260f4356453f) Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
* CMake: add Qt::Gui dependency by default for Android testsAssam Boudjelthia2021-02-111-1/+5
| | | | | | | | | | | | | | | | | | Normal Android apps require Qt::Gui dependency and since tests don't need to handle any special cases for an app without Qt::Gui, let's add it by default. This also will allow us to remove some workarounds done on CI side to run tests for Android. Fixes: QTBUG-90870 Change-Id: I845650c17a1b73e4c4977043f863ec44e50f06c3 Reviewed-by: Ville Voutilainen <ville.voutilainen@qt.io> Reviewed-by: Joerg Bornemann <joerg.bornemann@qt.io> Reviewed-by: Tor Arne Vestbø <tor.arne.vestbo@qt.io> Reviewed-by: BogDan Vatra <bogdan@kdab.com> (cherry picked from commit 85c7a9d3a6710f8487ce4aa1e4e2d7d1d46b6cde) Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
* Fix FindWrapOpenSSL.cmake if OpenSSL::Crypto is UNKNOWN_LIBRARYJoerg Bornemann2021-02-111-1/+1
| | | | | | | | | | | | The attempt to call target_link_libraries on OpenSSL::Crypto failed when this target was added as UNKNOWN library by FindOpenSSL.cmake. Instead, set the INTERFACE_LINK_LIBRARIES property directly. Fixes: QTBUG-90925 Change-Id: Idbc1379c89480225fc7a8d417416ed20404a1122 Reviewed-by: Fabian Kosmale <fabian.kosmale@qt.io> (cherry picked from commit b6b9e54f167aab104600f4d4a2db71ae70561c3b) Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
* Fix completely wrong init_class and jar_bundle_native valuesAlex Blasche2021-02-101-2/+2
| | | | | | | | | | | This prevented androiddeployqt from properly deploying libraries which specify init class via the ":" delimiter. Change-Id: Ib9cfa7edc864d7d540577df22284ceb9714a2511 Reviewed-by: Assam Boudjelthia <assam.boudjelthia@qt.io> Reviewed-by: Andreas Buhr <andreas.buhr@qt.io> (cherry picked from commit 8cceb04232001e51276f1588d9e67f2c696fbe91) Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
* Update name of c++2a to c++20Kai Köhne2021-02-102-2/+2
| | | | | | | | | | | Keep the c++2a feature, but make it an alias for compatibility purposes. Change-Id: I6f153109be84659806f1b7a57a88a187875166d8 Reviewed-by: Joerg Bornemann <joerg.bornemann@qt.io> Reviewed-by: Edward Welbourne <edward.welbourne@qt.io> (cherry picked from commit 3c412c93c251862a2791557881f9232fd76fda79) Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
* configure: Fix handling of -translationdir argumentJoerg Bornemann2021-02-081-1/+2
| | | | | | | | | | | This is supposed to be mapped to INSTALL_TRANSLATIONSDIR, not INSTALL_TRANSLATIONDIR (without the s). Fixes: QTBUG-90946 Change-Id: Icec93ffc0dc80d9ac7cf6cf1b13824bc2a1e795f Reviewed-by: Kai Koehne <kai.koehne@qt.io> (cherry picked from commit b9d1dc43f2764d765caf9fa8102aafea268ed3bb) Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
* CMake/QtAutoDetect: fix failure with multiline toolchain filePeter Seiderer2021-02-081-1/+1
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | The unquoted 'string(FIND ${toolchain_file_content} ...)' call fails for multiline content of the variable toolchain_file_content, so add quotes around, fixes: [...] CMake Error at cmake/QtAutoDetect.cmake:42 (string): string sub-command FIND requires 3 or 4 parameters. Call Stack (most recent call first): cmake/QtAutoDetect.cmake:311 (qt_auto_detect_android) CMakeLists.txt:19 (include) [...] -- Configuring incomplete, errors occurred! in case the given toolchain file starts with multiple lines in the first 80 characters, e.g. in the case of buildroot: # # Automatically generated file; DO NOT EDIT. # CMake toolchain file for Buildroot # [...] Task-number: QTBUG-90980 Change-Id: I8e038e08d83016e8253f2e83b2efb8f06034c6cd Reviewed-by: Joerg Bornemann <joerg.bornemann@qt.io> (cherry picked from commit 8aff901f70def69c2ac56754ef4146150e43bf8a) Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
* CMake: Fix HAVE_openssl config test when using static OpenSSLLi Xinwei2021-01-281-0/+12
| | | | | | | | | | | | | | | | | When using static OpenSSL, HAVE_openssl test will fail, because of unresolved external symbols. These symbols are from Ws2_32.lib and Crypt32.lib, which CMake does not link by default. In qmake build system, we can use OPENSSL_LIBS variable to specify these system libraries. But there is no similar variable in CMake build system. Accordingly, we should let OpenSSL::Crypto target link these libraries. Upstream issue: https://gitlab.kitware.com/cmake/cmake/-/issues/19263 Pick-to: 6.0 Change-Id: I5f27790b251d0a0f71aaf2aed2b933aeb3326f1f Reviewed-by: Craig Scott <craig.scott@qt.io> Reviewed-by: Joerg Bornemann <joerg.bornemann@qt.io>
* Clear non-relevant CMake compiler flagsAlexey Edelev2021-01-275-28/+104
| | | | | | | | | | | | | | | | Add internal function to cleanup compiler flags out of the CMAKE_xxx_FLAGS_xxx variables. Use introduced interface to clear the '/EHsc' flag for the MSVC compiler family. This adjusts the CMake behavior to the qmake one. Change the 'EXCEPTIONS' option handling in helper functions. Add ability to add enabling and disabling exception flags. Previously it was only possible to add disabling exception flags. Fixes: QTBUG-89952 Change-Id: I60d47660a97ae9b5a1d1f4107d352c9e97890144 Reviewed-by: Craig Scott <craig.scott@qt.io> Reviewed-by: Joerg Bornemann <joerg.bornemann@qt.io>
* Fix output files of the *_header_check targetsJoerg Bornemann2021-01-271-1/+3
| | | | | | | | | | | | | | | | | Header files of a Qt module are usually found in subdirectories. Avoid creating object file paths like "header_foo/bar.h.o". When building with conan, the "header_foo" subdirectory was not created for whatever reason. Now, we make sure we have clean object file paths, e.g. "header_check/foo/bar.h.o", and we create the directory upfront before invoking the compiler. Fixes: QTBUG-90529 Change-Id: Ifa5d6b97e07fc4e249c58cda5128439d60b14f5f Reviewed-by: Kai Koehne <kai.koehne@qt.io> (cherry picked from commit 54980200c79b466a276a4d3054390e4b3162e9ed) Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
* Fix QT_TOOL_PATH_SETUP_COMMANDJuha Vuolle2021-01-271-1/+1
| | | | | | | | | | | | | | Commit 18fc9e1bf821130f0cfe45dc7d5c05b70458e7c0 introduced a Windows-only QT_TOOL_PATH_SETUP_COMMAND to make it possible to call the tool of a module while building the module itself. The "set PATH=..." command in QT_TOOL_PATH_SETUP_COMMAND was flawed, because it contained escaped double quotes which made the set command ineffective. Fix this by removing the escaping of the double quotes. This was uncovered when porting qtscxml to CMake. Change-Id: I5909aa841e7895d6d0feb4037a935b805ccfdc99 Reviewed-by: Joerg Bornemann <joerg.bornemann@qt.io>
* ibase: Fix the compilation and include it again so it can be detectedAndy Shaw2021-01-261-0/+51
| | | | | Change-Id: I38721155f090173862da8beab8cb04b2e015dcff Reviewed-by: Christian Ehrlicher <ch.ehrlicher@gmx.de>
* Fix invalid Qt prefix version when looking for HostInfo moduleAlexey Edelev2021-01-263-12/+12
| | | | | | | | | | | | | | | | | | | In QtSetup.cmake the PROJECT_VERSION_MAJOR variable was used to identify prefix of 'Qt<version>HostInfoConfig.cmake'. Qt<version>HostInfo is not found, if project version differs from qtbase version. Move the 'INSTALL_CMAKE_NAMESPACE' and 'QT_CMAKE_EXPORT_NAMESPACE' variables to 'QtBuildInternalsConfig.cmake'. In this case variables will be exposed for a wider list of internal routines. Use the 'INSTALL_CMAKE_NAMESPACE' variable as prefix to find Qt<version>HostInfo module. Fixes: QTBUG-90345 Change-Id: Ic595d1c5beb74f34e69b58e18590a3afc2f346f7 Reviewed-by: Qt CI Bot <qt_ci_bot@qt-project.org> Reviewed-by: Joerg Bornemann <joerg.bornemann@qt.io>
* Add upstream version of FindPostgreSQL.cmakeAlexey Edelev2021-01-261-0/+317
| | | | | | | | | | | | Add CMake upstream(3.20.0) version of FindPostgreSQL.cmake, to avoid server-related headers lookup. Avoid using the Qt version of the PostgreSQL module, if it's older than the CMake's one. Fixes: QTBUG-89639 Change-Id: I71a0c3508000901969933aea8a08d1ad431db711 Reviewed-by: Craig Scott <craig.scott@qt.io> Reviewed-by: Joerg Bornemann <joerg.bornemann@qt.io>
* Ensure consistent flags for ASM language and MODULE targetsCraig Scott2021-01-261-2/+2
| | | | | | | | | | | | | | | | | | | By not including ASM in the languages for which compiler flags are adjusted, we can end up with inconsistent optimization and debug settings between different languages. Make sure they are treated the same. Similarly, linker flags for MODULE target types should also have their debugging and incremental linking flags adjusted, just like EXE and SHARED targets. When building with MSVC, MODULE targets were having the relevant flags stripped, but not then replaced with the desired ones, leaving them empty in typical scenarios. This would primarily affect plugins, which are built as MODULE rather than SHARED libraries. Fixes: QTBUG-90237 Change-Id: I648ea74be1654d24cbecc592ce0ca4b59b2ae839 Reviewed-by: Joerg Bornemann <joerg.bornemann@qt.io> Reviewed-by: Qt CI Bot <qt_ci_bot@qt-project.org>
* Update start of cmake/README.mdKai Köhne2021-01-251-18/+18
| | | | | | | | | | | | | | Make the document reflect the current status of the port. Also link to https://doc.qt.io/qt-6/build-sources.html and https://wiki.qt.io/Building_Qt_6_from_Git as official sources on how to build Qt. This document should IMO rather concentrate on documenting the build system internals. Pick-to: 6.0 Change-Id: If62cb966b41b7452edb5b63725756916b66affac Reviewed-by: Craig Scott <craig.scott@qt.io> Reviewed-by: Joerg Bornemann <joerg.bornemann@qt.io>
* Bump copyright year to 2021Kai Köhne2021-01-251-1/+1
| | | | | | Change-Id: I18a9c2de391ca51655148b2e3cc9abdfbb8ddbcf Reviewed-by: Tarja Sundqvist <tarja.sundqvist@qt.io> Reviewed-by: Joerg Bornemann <joerg.bornemann@qt.io>
* Fix QMAKE_PRL_LIBS entries on Windows for modules from other reposJoerg Bornemann2021-01-221-1/+1
| | | | | | | | | | | | | | | | | | | | | When building a repository != qtbase, like qtactiveqt, QMAKE_PRL_LIBS contained entries like Qt6Core and Qt6Widgets, meaning the linker line would contain exactly these arguments. When building an activeqt example with qmake, the link then failed with "LNK1181: cannot open input file 'Qt6Widgets.obj'". The correct entry would have been $$[QT_INSTALL_LIBS]/Qt6Widgets.obj. Fix this by determining the full path to the import library in the first step of the prl generation. This enables QtFinishPrlFile.cmake to recognize Qt6Widgets as Qt module and generate the right QMAKE_PRL_LIBS entry. Pick-to: 6.0 Fixes: QTBUG-90520 Change-Id: Id0d9178da0e0dfc3ea4fadbbe8f5900d792ffc84 Reviewed-by: Kai Koehne <kai.koehne@qt.io>
* Tune compilation flags to reduce libraries sizeAlexey Edelev2021-01-222-1/+15
| | | | | | | | | | | | Add '_WINDLL' definition for the MSVC compilers family. Check the 'FEATURE_optimize_size' value before replacing compiler flags in the qt_internal_add_optimize_full_flags function. This is required, because Qt::Core and Qt::Gui modules lost their ability to shrink, when selecting the appropriate build type or features. Fixes: QTBUG-89952 Change-Id: I982c25ea84e4793b4006ead0ee516b3f3eb2a054 Reviewed-by: Joerg Bornemann <joerg.bornemann@qt.io>
* Fix static top-level buildJoerg Bornemann2021-01-221-7/+7
| | | | | | | | | | | | | | Commit d0071a4f871 broke static top-level builds: CMake Error at .../qtbase/lib/cmake/Qt6Gui/Qt6GuiPlugins.cmake:17 (set_property): set_property can not be used on an ALIAS target. Fixed by moving the un-aliasing of the target before the set_property call. Pick-to: 6.0 Change-Id: I96c731353798a58ff9b3a664f3614ef03c897dcb Reviewed-by: Tor Arne Vestbø <tor.arne.vestbo@qt.io>
* Only generate and add static plugin imports once per module targetCraig Scott2021-01-211-2/+18
| | | | | | | | | | | | | | | | | | | Projects may call find_package(Qt6 ...) multiple times. When enabling examples and tests, this happens a lot. For a statically built Qt, for modules that have plugins (e.g. Gui), every time the module's config file was loaded, it was generating and adding another copy of the import plugin sources to the module target. These accumulated and created many duplicates, which in turn blew out generation time and made the build very inefficient. This change checks whether the import plugin sources have already been processed for the module target and ensures they are only added once. It records its status on the target itself so that both local and global targets are supported. Fixes: QTBUG-90465 Change-Id: I1f45b1ee771a933ee755d44f1e983d6d9113dad0 Reviewed-by: Joerg Bornemann <joerg.bornemann@qt.io>
* Do not export the QT_PLUGINS target property of Qt modulesJoerg Bornemann2021-01-202-3/+2
| | | | | | | | | | | This property is dynamically determined and set in the Qt6${module-name}PluginsConfig.cmake files now. There is no need anymore to export this property. Change-Id: I2d164864c4099034b88f9ad852eae8b9f9e55f8b Reviewed-by: Alexey Edelev <alexey.edelev@qt.io> Reviewed-by: Cristian Adam <cristian.adam@qt.io>
* Fix loading of Qt6*Plugin.cmake files of per-repo buildsJoerg Bornemann2021-01-202-10/+15
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | When doing a per-repository build of Qt, as it is done for the installer packages, the build of qtbase has no knowledge of plugins that might be built and installed from other repositories. That means we must not write a fixed list of known plugins when exporting Qt modules of qtbase. In particular, qtsvg adds imageformat plugins that are supposed to be picked up by qtbase's QtGui module when linking a project against a statically linked Qt. ${install-prefix}/lib/cmake/Qt6Gui/Qt6GuiPlugins.cmake missed the include statements for qtsvg's plugin config files and operated on a fixed list of plugins, all from qtbase. Apart from that, the Qt6::Gui target's property QT_PLUGINS did only contain the qtbase plugins. This patch fixes the situation in the following way: 1. All Qt6*PluginConfig.cmake files in ${install-prefix}/lib/cmake/Qt6Gui are detected and included. 2. From those file names, the target names of the plugins are deduced. This is safe as the file name of those generated files is a direct result of the plugin's target name. 3. The QT_PLUGINS property of the module is updated with the detected plugin target names. Fixes: QTBUG-89643 Change-Id: Ifc3c39aa9948277ead5ebb209ec5eff64746308b Reviewed-by: Alexey Edelev <alexey.edelev@qt.io> Reviewed-by: Cristian Adam <cristian.adam@qt.io>
* Add arguments to 'qt_manual_moc' to resolve 'moc' includesAlexey Edelev2021-01-201-1/+19
| | | | | | | | | | | | | | 'qt_manual_moc' doesn't provide include paths for 'moc' command to substitute required macros. This change adds the 'INCLUDE_DIRECTORIES' and 'INCLUDE_DIRECTORY_TARGETS' arguments to the 'qt_manual_moc' function. If 'INCLUDE_DIRECTORY_TARGETS' is specified, 'qt_manual_moc' collects 'INTERFACE_INCLUDE_DIRECTORIES' of provided targets and uses them as the 'moc' include directories. Change-Id: I58c8887dae3ca2484574c5e12e2cbd47f5bd3648 Reviewed-by: Craig Scott <craig.scott@qt.io> Reviewed-by: Fabian Kosmale <fabian.kosmale@qt.io>
* CMake: Use private headers for internal module priJaeyoon Jung2021-01-201-0/+2
| | | | | | | | | | | | Just like config_module_name is appended by "_private" in the case of internal module pri, replace module_includes with the private one. It fixes the issue where a pro file that uses an internal module pri does not build due to missing paths to private headers. Fixes: QTBUG-89961 Change-Id: Ice16a1e9f709d29454f1ddf5b954673cc06a88bb Reviewed-by: Joerg Bornemann <joerg.bornemann@qt.io> Reviewed-by: Jaeyoon Jung <jaeyoon.jung@lge.com>
* cmake: Bail out in case syncqt failed to runKevin Funk2021-01-201-1/+4
| | | | | | | | | | | | | | Make sure to react on failed syncqt runs during the CMake run. CMake will now report something along this: ``` syncqt couldn't parse .../qt5/qtbase/sync.profile: Can't modify modulus (%) in scalar assignment at .../qt5/qtbase/sync.profile line 25, near ");" CMake Error at qtbase/cmake/QtModuleHelpers.cmake:192 (message): Failed to run syncqt, return code: 255 ``` Change-Id: I575a5fc926c547b6b633583e5d675f7e35beb734 Reviewed-by: Joerg Bornemann <joerg.bornemann@qt.io>
* Fix framework path for *_header_check targetsJoerg Bornemann2021-01-191-1/+1
| | | | | | | | | | | | | | | | | | | When building a Qt module against an installer-provided Qt on macOS, the module pulls in the headersclean feature that creates the *_header_check targets. Those targets try to compile the public headers of the module, and the compilation command contains the -iframework argument. That -iframework argument is supposed to point to the directory where the Qt libs are installed. However, it pointed to the original CMAKE_INSTALL_PREFIX of the machine where Qt was packaged. Use the QT_BUILD_INTERNALS_RELOCATABLE_INSTALL_PREFIX variable instead that contains the real installation location, even for an installer-provided Qt. Pick-to: 6.0 Fixes: QTBUG-90402 Change-Id: I27de8b3cc816488c2716042383b334d5c421452d Reviewed-by: Tor Arne Vestbø <tor.arne.vestbo@qt.io>
* Move UNICODE and _UNICODE definitions to internal platform targetAlexey Edelev2021-01-192-1/+5
| | | | | | | | | | Move UNICODE and _UNICODE definitions from the public Qt::Platform target to the private Qt::PlatformCommonInternal target. Fixes: QTBUG-89951 Change-Id: Ib4c1c4cab74acda0a43c4ddb3cffd3954393dc89 Reviewed-by: Kai Koehne <kai.koehne@qt.io> Reviewed-by: Qt CI Bot <qt_ci_bot@qt-project.org>
* Adjust database packages FindFoo.cmake files to CMake conventionAlexey Edelev2021-01-193-36/+41
| | | | | | | | | | | Replace package _LIBRARIES by _LIBRARY and _INCLUDE_DIRS by _INCLUDE_DIR. Move find_package_handle_standard_args for Oracle and DB2, since this call should set _FOUND variable but not separate condition. Fixes: QTBUG-89866 Change-Id: I54be2c2c4d7ba4b849a27139702861ecd937c444 Reviewed-by: Craig Scott <craig.scott@qt.io> Reviewed-by: Joerg Bornemann <joerg.bornemann@qt.io>
* QtEntryPoint: Fix linking Release against RelWithDebInfo with MSVCJoerg Bornemann2021-01-181-5/+13
| | | | | | | | | | | | | | | | | | | | | | | | | | | | To be able to link a Release user project against a RelWithDebInfo Qt we set several IMPORTED_*_RELEASE properties in the *AdditionalTargetInfo.cmake file of each Qt module. The EntryPoint module however is a bit special as it is an INTERFACE_LIBRARY linking publicly against a static library (EntryPointimplementation). Its *AdditionalTargetInfo.cmake file was almost empty, because qt_internal_export_additional_targets_file was called before EntryPointImplementation was set up. Also, qt_internal_add_module, which calls qt_internal_export_additional_targets_file, does not know that we want to export the EntryPointImplementation target. We fix this by telling qt_internal_add_module(EntryPoint) to not generate the *AdditionalTargetInfo.cmake file and call qt_internal_export_additional_targets_file later to take the targets EntryPoint and EntryPointImplementation into consideration. qt_internal_add_module learned the option NO_ADDITIONAL_TARGET_INFO to turn off the generation of *AdditionalTargetInfo.cmake files. Pick-to: 6.0 Fixes: QTBUG-90039 Change-Id: I68ec7125b538a57567035e7adb8dac3b213f95e6 Reviewed-by: Tor Arne Vestbø <tor.arne.vestbo@qt.io>
* FindLibb2: Don't rely solely on pkg-configCraig Scott2021-01-181-3/+33
| | | | | | Task-number: QTBUG-86283 Change-Id: Ie455d7cfc6e6f9ae8297f8bc0daf2816ccce91b6 Reviewed-by: Joerg Bornemann <joerg.bornemann@qt.io>
* Make -pkg-config configure option actually workCraig Scott2021-01-181-0/+6
| | | | | | | | | | | The QtBuildInternals config package file gets processed before feature evaluation occurs. That means INPUT_pkg_config may be defined, but the corresponding FEATURE_pkg_config variable won't have been set/updated yet. Do this check locally because the availability of a number of features is conditional on whether pkg-config is available. Change-Id: I6030eb380ee0c630ffbe5db5eed397a46227c7f6 Reviewed-by: Joerg Bornemann <joerg.bornemann@qt.io>