Keep the c++2a feature, but make it an alias for compatibility
purposes.
Pick-to: 6.1
Change-Id: I6f153109be84659806f1b7a57a88a187875166d8
Reviewed-by: Joerg Bornemann <joerg.bornemann@qt.io>
Reviewed-by: Edward Welbourne <edward.welbourne@qt.io>
This is supposed to be mapped to INSTALL_TRANSLATIONSDIR, not
INSTALL_TRANSLATIONDIR (without the s).
Pick-to: 6.0 6.1
Fixes: QTBUG-90946
Change-Id: Icec93ffc0dc80d9ac7cf6cf1b13824bc2a1e795f
Reviewed-by: Kai Koehne <kai.koehne@qt.io>
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
Pick-to: 6.0 6.1
Change-Id: I8e038e08d83016e8253f2e83b2efb8f06034c6cd
Reviewed-by: Joerg Bornemann <joerg.bornemann@qt.io>
Developer builds with RelWithDebInfo should also make benchmarks, it
is how we get good traces.
Change-Id: I009d40580d5d784f78bd18ebf21887ce3c1fa97d
Reviewed-by: Joerg Bornemann <joerg.bornemann@qt.io>
In apple systems it's necessary to pass the framework paths to the moc
generator to resolve required header files. We need to collect framework
paths for all INCLUDE_DIRECTORY_TARGETS and add them to the command line
of the moc generator.
Task-number: QTBUG-84906
Change-Id: I9e6356e7e0a5f2493823ec764a48b0b8f1c8c10d
Reviewed-by: Joerg Bornemann <joerg.bornemann@qt.io>
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>
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>
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>
Commit 18fc9e1bf8 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>
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 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>
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>
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>
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>
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>
Commit d0071a4f87 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>
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>
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>
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>
'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>
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>
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>
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 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>
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>
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>
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>
Add an optional argument to store the report command while feature
evaluation-only stage. This is necessary, because according to the
actual feature evaluation process, evaluation happens only once and it's
impossible to record any command during the evaluation-only stage.
Fixes: QTBUG-90319
Change-Id: I215fbe0a28a2661cd2d97d253b2e2c787d295cbd
Reviewed-by: Joerg Bornemann <joerg.bornemann@qt.io>
Reviewed-by: Jason McDonald <macadder1@gmail.com>
Functions in QtFlagHandlingHelpers.cmake try to update the CMake cache
variables for compiler and linker flags. These were using the current
value of those variables and writing the modified ones back to the
cache every time CMake ran. If a toolchain file sets or modifies any of
these variables, that updated value is used and written back into the
cache instead of the original cache variable's value. The next time
CMake executes, the toolchain file re-applies the same change and the
variable grows longer each time with flags repeated. With Ninja, this
causes a complete rebuild every time CMake is re-run. The Android NDK
toolchain file is one example where this behavior is triggered (the
fault is shared, one could argue that the NDK should only be setting
..._INIT variables, but that's out of our control).
Another related bug in the previous implementation was that the flags
used to build after the first CMake execution could be different to
those used for all builds after the second and later CMake runs. This
is because the CMake cache was being updated, but not always the
calling scope of the functions that modified them. If a toolchain file
set any of the compiler or linker flag variables as non-cache
variables, then updating the cache variable would have no effect on
the calling scope. The non-cache variable would continue to take
precedence for that scope for that run. The next time CMake executes
though, the updated cache variable would now have been used by the
toolchain file and the change *will* be part of the non-cache
variable's value.
The above are examples of why you should try to avoid updating these
cache variables from project code. We could leave the cache alone and
always update only non-cache variables, but then a developer looking
at the cache may wonder why the values they see there don't match the
values being used in builds. Or worse, they think the cache values
are being used and don't realize the builds are using something
different. Ultimately, we have to choose which downside we are happy
to live with. The changes here preserve the previous intent of
updating the cache, but it's still a bit fragile.
Fixes: QTBUG-89821
Task-number: QTBUG-85992
Task-number: QTBUG-86866
Change-Id: I8a16753e159bde338e6d2e5dd2ce91fc8ac5c39d
Reviewed-by: Joerg Bornemann <joerg.bornemann@qt.io>
Ubuntu 20.04 is a supported platform and comes with CMake 3.16. The
current state of the Qt build works fine with this CMake version, mainly
because the default build on Linux is single-config.
For multi-config builds we have higher version requirements as
documented in cmake/README.md.
This lowers the barrier for users using single-config builds who don't
want or cannot upgrade to CMake >= 3.18.
For Ninja Multi-Config builds, which were introduced by CMake 3.17, we
yield a warning that 3.18.3 is the lowest supported version.
Pick-to: 6.0
Change-Id: Ia918b9f2b494508e86301ffc0e138d3ad4dbaf86
Reviewed-by: Craig Scott <craig.scott@qt.io>
Reviewed-by: Lars Knoll <lars.knoll@qt.io>
CMake <= 3.19 adds the '-fno-fat-lto-objects' compiler flag
unconditionally when CMAKE_INTERPROCEDURAL_OPTIMIZATION is enabled.
This is fine for shared libraries but static ones need the opposite
compiler flag.
Task-number: QTBUG-89426
Pick-to: 6.0
Change-Id: Ie5f48178803a270f6d94408f7a8e85d379eb123c
Reviewed-by: Joerg Bornemann <joerg.bornemann@qt.io>
Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
Since test command variable may contain quotes, there is a warning
in generated test wrappers related to 'message(FATAL_ERROR', that
should display full command in log in case of error. To avoid any
complicated quoting of command to only display it, join command into
single string in wrapper script and pass resulting variable to
'message(FATAL_ERROR'.
Pick-to: 6.0
Change-Id: Ie990fc0b0bf2c19b119c7c4e2aeec092e5200103
Reviewed-by: Joerg Bornemann <joerg.bornemann@qt.io>
Use upper-level document build directory for generated .qch files. This
avoids copying of .qch with html documents and duplicating them in
the installation directory.
Pick-to: 6.0
Change-Id: I63b2de0047005419d352ea259dec6f17a826a477
Reviewed-by: Joerg Bornemann <joerg.bornemann@qt.io>
In latest Oracle Instant Client releases for windows the OCI library
name is 'oci.dll'. Add it as option to find_library call.
Change-Id: I6e6f4a998207d16583a380c1bd95db857051606b
Reviewed-by: Joerg Bornemann <joerg.bornemann@qt.io>
Add explicit error, if multi-config build is requested, but selected
generator doesn't support it.
Fixes: QTBUG-88287
Pick-to: 6.0
Change-Id: I6dba589bb59ad69fa07221c657df272ec75c359b
Reviewed-by: Joerg Bornemann <joerg.bornemann@qt.io>
Add output of feature condition error at the end of configuration
summary. Introduce qt_configure_add_report_error that may be used
to add error to end-point configure report without actual
configure interruption.
Fixes: QTBUG-88282
Change-Id: Idcf478da863ae6507438eb3370927d7d1f01e071
Reviewed-by: Joerg Bornemann <joerg.bornemann@qt.io>
This reverts commit 642ee46f98.
Reason for revert: Issue when command_count is actually 0
Pick-to: 6.0
Change-Id: I1b2603f25b56e3bd50cfc22a08925930ad231498
Reviewed-by: Cristian Adam <cristian.adam@qt.io>
Use LESS_EQUAL condition since qt_configure_command_count stores last
added command index but not actual count
Fixes: QTBUG-88054
Pick-to: 6.0
Change-Id: I8112820f9885bdad5a786a4f6b4890d8f2fbe14b
Reviewed-by: Cristian Adam <cristian.adam@qt.io>
Use the QT_MKSPECS_DIR instead of QT_SOURCE_TREE to find out the
location for the testserver feature's data. QT_SOURCE_TREE points to
qtbase source location, which may not be always available. This allows
to use this feature by projects outside of qtbase.
Task-number: QTBUG-85034
Change-Id: If7fa6ef95777be9acf35d36f8d99776bf9568a79
Reviewed-by: Cristian Adam <cristian.adam@qt.io>
Introduce a new QT_TESTSERVER_COMPOSE_FILE variable for setting a custom
docker compose file path, which can be set by projects outside of qtbase
(e.g. QtCoap). If the variable is not set, fallback to the compose file
located in qtbase.
Task-number: QTBUG-85034
Change-Id: I4c0c9b161cad9787b089ef7e9da2aa00352a9159
Reviewed-by: Cristian Adam <cristian.adam@qt.io>
'QT_HOST_PATH' indicates that we use crosscompilation toolchain
to build project. In this case 'Qt6Config.cmake' loads
'Qt6HostInfoConfig.cmake' from host QT_HOST_PATH, that defines
correct paths to host tools.
Replace hardcoded paths for host tools by paths recorded
in Qt6HostInfoConfig.cmake.
Correct conditions for QT_HOST_PATH, evaluate it explicitly as
string, but not as boolean expression.
Fixes: QTBUG-86557
Pick-to: 6.0
Change-Id: Ib52bbd32478051d019a932dcb1f735e2d4aacfbf
Reviewed-by: Qt CI Bot <qt_ci_bot@qt-project.org>
Reviewed-by: Joerg Bornemann <joerg.bornemann@qt.io>
With Ninja Multi-Config, QMAKE_LIBS_FOO_DEBUG and QMAKE_LIBS_FOO_RELEASE
are generated, if their values differ. In that case we did not create an
empty QMAKE_LIBS_FOO assignment. That, however, is needed to make the
library 'foo' known to qmake_use.prf.
This amends bd98ba0d17.
Fixes: QTBUG-89387
Change-Id: I80e23746e6ba6ff7f5f4186116232395814cee15
Reviewed-by: Cristian Adam <cristian.adam@qt.io>
Unset all QT_FEATURE_foo values for every build.
If any of FEATURE_foo is different of QT_FEATURE_foo, mark whole Qt
build as dirty. Reset FEATURE_foo for dirty builds to the calculated
value if it doesn't meet its condition.
Set Qt module as NOT FOUND if its target was not created during
configuration.
Main issue with this approach are generated files, that became trash
once the related features are disabled. This especially affects features
that enable/disable Qt modules. FooConfig.cmake files are created and
generate lots of warnings if feature was disabled. We may introduce a
module cleanup procedure at some point.
Fixes: QTBUG-85962
Pick-to: 6.0
Change-Id: Id71c1edb4027b24c6793063e40cc9d612c24ebce
Reviewed-by: Joerg Bornemann <joerg.bornemann@qt.io>
Build qtbase with -DFEATURE_static_runtime=ON, and then separately build
another module, following build error occurs:
error LNK2038: mismatch detected for 'RuntimeLibrary': value
'MT_StaticRelease' doesn't match value 'MD_DynamicRelease'.
That's because all the sources in this module are compiled with 'MD'.
When separately building a module except qtbase, FEATURE_static_runtime
is not exist in cmake cache. So we should use QT_FEATURE_static_runtime
instead of FEATURE_static_runtime in qt_set_common_target_properties.
Additionally, adjust the indentation.
Pick-to: 6.0
Change-Id: I2cf4737db9d3e8533570039a66c7d277d62a8d14
Reviewed-by: Joerg Bornemann <joerg.bornemann@qt.io>
When using MSVC compiler and -DFEATURE_static_runtime=ON, qrc_foo.cpp
and qtentrypoint_win.cpp are still compiled with '-MD' or '-MDd' flag,
which will cause following warnings and other possible problems:
warning LNK4098: defaultlib "MSVCRT" conflicts with use of other libs;
use /NODEFAULTLIB:library
Pick-to: 6.0
Change-Id: I6794930a64e9cff4dc1c9632fc3fc64227848af0
Reviewed-by: Yuhang Zhao <2546789017@qq.com>
Reviewed-by: Joerg Bornemann <joerg.bornemann@qt.io>
The scripts that are used by Android test VMs are now located in qtbase
and are not easily usable by other modules. To fix that and allow other
modules to use those scripts, we install them with cmake into libexec.
Task-number: QTQAINFRA-4052
Pick-to: 6.0
Change-Id: Ibdd3658fd9fe7e007104a85d9999028a2de99a33
Reviewed-by: Alexandru Croitor <alexandru.croitor@qt.io>
Wrap benchmark executable target with cmake script to run it on windows
without necessity of environment variables set.
Move common logic related to test and benchmark environment to
'qt_internal_collect_command_environment' function.
Make error message of wrapper script a bit more verbose.
Amends 61d5b01972
Task-number: QTBUG-89076
Pick-to: 6.0
Change-Id: I6ad3a027dc071176070cf3af4cf306f20d652039
Reviewed-by: Alexandru Croitor <alexandru.croitor@qt.io>
Reviewed-by: Qt CI Bot <qt_ci_bot@qt-project.org>
Refactor test adding procedure. It's expected that for each new
platform we prepare test executable and arguments first and then
pass them to common test adding section.
Rename '_qt_internal_wrap_test' to 'qt_internal_create_command_script'
Rework paramerters handling of 'qt_internal_create_command_script',
make them named.
Add 'qt_internal_create_test_script' to add tests and wrap them using
'qt_internal_create_command_script'.
Amends f19266bd02
Fixes: QTBUG-88053
Pick-to: 6.0
Change-Id: I812f4a295005bf3a85cdcb5b8c41180f8249dc96
Reviewed-by: Alexandru Croitor <alexandru.croitor@qt.io>
qt-cmake-standalone-test would be looking for the config files under
the target machine install prefix instead of under the staging prefix
on the build host.
Change-Id: I29850af6d8fe502f4944f689ec10539d17ccdcb9
Pick-to: 6.0
Reviewed-by: Alexandru Croitor <alexandru.croitor@qt.io>
Use 'separate_arguments' to explicitly split arguments from environment
that form 'COMMAND' for execute_process. Enclose using bracket syntax
arguments, that propagated to wrapper script as pure strings.
Amends f19266bd02
Pick-to: 6.0
Change-Id: I858ddff7efa281f9cecfda656a02e1fd12361758
Reviewed-by: Alexandru Croitor <alexandru.croitor@qt.io>
This was needed, when the mkspecs directory was not present in the
non-prefix build directory. That's not the case anymore.
Pick-to: 6.0
Fixes: QTBUG-89182
Change-Id: I2b04c2d857b0af324e1d7c41ed1934a62275d6f1
Reviewed-by: Alexandru Croitor <alexandru.croitor@qt.io>
There is no point in generating cpp files containing Q_IMPORT_PLUGIN()
macro calls for non-executable targets like modules, plugins and object
libraries in a static Qt build.
It causes unnecessary compiling of 10+ files for each of those targets.
In a static Qt build, plugin imports should only be done for executables,
tools and applications.
Pick-to: 6.0
Change-Id: Ied90ef2f6d77a61a093d393cfdf94c400284c4f0
Reviewed-by: Craig Scott <craig.scott@qt.io>
Reviewed-by: Joerg Bornemann <joerg.bornemann@qt.io>
Disabled by default as they are currently not being built and many are
not working properly, this will allow us to start using them again.
Change-Id: I823368d04e9fde2beccabedc3ca15efd1f355bfb
Pick-to: 6.0
Reviewed-by: Alexandru Croitor <alexandru.croitor@qt.io>
In some case CROSSCOMPILING_EMULATOR property is not INHERITED and is
set to 'NOTFOUND' by get_test_property. Force it to empty string in
this case.
Add missed 'name' argument to '_qt_internal_wrap_test'. 'name'
previously was used from parent scope.
Pick-to: 6.0
Fixes: QTBUG-88053
Change-Id: I5286bcb9b11659f638e178ce52172dfee994fc34
Reviewed-by: Alexandru Croitor <alexandru.croitor@qt.io>
Add custom targets with '_benchmark' suffixes to make run of
benchmarks using generators possible, e.g.:
$ ninja tst_bench_qudpsocket_benchmark
Extend '-[no]make' option to pass benchmark. Rework
'-[no]make' processing to unify these options processing.
Also looks like it doesn't make sense to enable benchmarks without
having test enabled. So '-DQT_BUILD_BENCHMARKS' enables test as own
dependency automatically.
Task-number: QTBUG-89076
Pick-to: 6.0
Change-Id: Ieee9eadaf6d75a1efec120242d6eb786ace1b071
Reviewed-by: Alexandru Croitor <alexandru.croitor@qt.io>
When a CMake release introduces a new policy that affects most Qt
modules, it may be appropriate to make each module aware of that newer
CMake version and use the NEW policy without raising the minimum CMake
version requirement. To reduce the churn associated with making that
change across all Qt modules individually, this change allows it to be
updated in a central place (qtbase), but in a way that allows a Qt
module to override it in its own .cmake.conf file if required (e.g. to
address the issues identified by policy warnings at a later time). The
policies are modified at the start of the call to
qt_build_repo_begin().
For commands defined by the qtbase module, qtbase needs to be in
control of the policy settings at the point where those commands are
defined. The above mechanism should not affect the policy settings for
these commands, so the various *Config.cmake.in files must not specify
policy ranges in a way that a Qt module's .cmake.conf file could
influence.
Starting with CMake 3.12, policies can be specified as a version range
with the cmake_minimum_required() and cmake_policy() commands. All
policies introduced in CMake versions up to the upper limit of that
range will be set to NEW. The actual version of CMake being used only
has to be at least the lower limit of the specified version range.
This change uses cmake_minimum_required() rather than cmake_policy()
due to the latter not halting further processing upon failure.
See the following:
https://gitlab.kitware.com/cmake/cmake/-/issues/21557
Task-number: QTBUG-88700
Pick-to: 6.0
Change-Id: I0a1f2611dd629f847a18186394f500d7f52753bc
Reviewed-by: Alexandru Croitor <alexandru.croitor@qt.io>
Wrap Qt tests to handle TESTRUNNER and TESTARGS environment variables.
Variables are handled according to qmake build procedure. All test
now are wrapped by generated CMake script.
Fixes: QTBUG-88053
Pick-to: 6.0
Change-Id: I339977ce6ce11ddd38a4bf0bd26eb8f2ae463ba3
Reviewed-by: Qt CI Bot <qt_ci_bot@qt-project.org>
Reviewed-by: Alexandru Croitor <alexandru.croitor@qt.io>
We want to remove the Qt .pro files for projects, except examples,
because examples are still meant to build with qmake.
To not lose coverage on examples built with qmake, add instructions that
will build the qtrepo/examples folder with qmake when the CMake
configuration has -DQT_BUILD_EXAMPLES=ON.
This means that such configurations will build examples both with CMake
and qmake.
Aside from making sure that our examples will still build with qmake, it
will gives us some some coverage that a CMake-built qmake works
correctly.
Implementation-wise, add new instructions files that can call qmake and
make depending on configuration and target type.
Pick-to: 6.0
Fixes: QTBUG-85986
Change-Id: Ie8f4cbcda03c94da2aef455e32f48dad41a4bdb0
Reviewed-by: Alexandru Croitor <alexandru.croitor@qt.io>
The qmake build system defines _CRT_SECURE_NO_WARNINGS in
mkspecs/features/qt_module.prf, the cmake build system should do the
same thing in qt_internal_add_module().
Adding this definition can avoid warnings like:
warning C4996: 'strncpy': This function or variable may be unsafe.
As a special case, Bootstrap uses add_library() instead of
qt_internal_add_module(), so _CRT_SECURE_NO_WARNINGS should also be
defined in src/tools/bootstrap/CMakeLists.txt.
Pick-to: 6.0
Change-Id: Ic82193d177f82785fd84948efa78c49ca8d8db46
Reviewed-by: Alexandru Croitor <alexandru.croitor@qt.io>
I'll preface by saying, it's not clear to me why the behavior is
different.
Our qt_run_config_test_architecture function builds a target
executable, and then uses file(STRINGS) to try and parse out some
magic strings that we expect the executable to have (architecture,
abi, etc).
In qmake this was done by matching with a regular expression ending on
a \\0 null byte character.
In CMake, we do a string(FIND) and string(SUBSTRING until the end of
the line) on a *line* returned from file(STRINGS). Notably, I did not
find any regexp syntax provided by CMake to try and match a null byte
character.
Note the docs for file(STRINGS) implies to me that *lines* are
detected by looking for newline characters '\n'. The docs also
mention that binary data in the file is ignored. What's binary
data though?
If you open the executable with a hex editor, at least on macOS, the
strings we are interested in are indeed separated by null byte chars,
not newline chars.
On most platforms file(STRINGS) did end a line on the null byte
character.
Except, for some reason not when building Qt for the oss-fuzz project
with clang under Docker.
Calling message() on one of the lines prints a very long string with
null characters seemingly replaced with semicolons, and of course the
matched architecture string is wrong and fails configuration.
For *some reason*, if I add a "REGEX ==Qt=magic=Qt==" option to the
file(STRINGS) command, the captured output lines don't contain
semicolons even when building for oss-fuzz.
The extracted strings are then correct, and configuration succeeds.
Use the REGEX option workaround, with the aim to quickly fix Qt
building for oss-fuzz for 6.0.1 release.
Pick-to: 6.0
Fixes: QTBUG-89047
Change-Id: Iad11c1090c1187aadd39082f196050bf3290df95
Reviewed-by: Robert Loehning <robert.loehning@qt.io>
Reviewed-by: Cristian Adam <cristian.adam@qt.io>
Reviewed-by: Joerg Bornemann <joerg.bornemann@qt.io>
QMake libraries that contain dashes are referenced by QMAKE_USE as is,
but the corresponding QMAKE_LIB_<NAME> variable must be normalized to
contain underscores.
Example from the qmake build:
./mkspecs/modules/qt_lib_waylandclient.pri
11:QT.waylandclient.uses = wayland-client xkbcommon wayland-cursor
./mkspecs/modules/qt_lib_waylandclient_private.pri
12:QMAKE_DEPENDS_WAYLAND_CURSOR_CC = WAYLAND_CLIENT
13:QMAKE_DEPENDS_WAYLAND_CURSOR_LD = WAYLAND_CLIENT
15:QMAKE_LIBS_WAYLAND_CURSOR = -lwayland-cursor
Pick-to: 6.0
Change-Id: If31bd45764d52f97d80d6388503008dc1ffb16ab
Reviewed-by: Alexandru Croitor <alexandru.croitor@qt.io>
Which is probably the direct port of -nomake XXX, as qmake
always offered the way to build tests/examples/etc. after
configuring without, while cmake doesn't.
Pick-to: 6.0
Change-Id: I85b039e56cde3ddfaf661385100d3c3a8cc2ac16
Reviewed-by: Alexandru Croitor <alexandru.croitor@qt.io>
Those entries were always empty. The INTERFACE_QT_MODULE_USES property
was never set.
Map each public dependency to its qmake lib name and place this value
into the module's QT.<module-name>.uses variable.
Take into account the "_nolink" target modifier and translate it to
qmake's "/nolink".
Pick-to: 6.0
Fixes: QTBUG-88951
Change-Id: Ib6ef65b842a1fe1da3ade55867583343b4ee76ee
Reviewed-by: Alexandru Croitor <alexandru.croitor@qt.io>
Rename QT_QMAKE_LIB_TARGETS_foo to QT_TARGETS_OF_QMAKE_LIB_foo, because
we want to introduce the counterpart QT_QMAKE_LIB_OF_TARGET_bar in a
subsequent commit.
Pick-to: 6.0
Task-number: QTBUG-88951
Change-Id: I33f00f4fe65c5977da6e74c632ebeab3b891c89a
Reviewed-by: Alexandru Croitor <alexandru.croitor@qt.io>
Consider a qmake lib 'foo' that doesn't have entries in
QMAKE_LIBS_FOO. Then we must not discard this entry in the generated
module pri file, because otherwise any attempt to QMAKE_USE 'foo' will
fail with the error message "Library 'foo' is not defined.".
Pick-to: 6.0
Task-number: QTBUG-88951
Change-Id: Ibed283857f5f66b1b79459fe7b7cf06c7ce0691d
Reviewed-by: Alexandru Croitor <alexandru.croitor@qt.io>
Add '_qt_internal_dump_expression_values' function that dumps all
values evaluated by 'qt_evaluate_config_expression'.
'_qt_internal_dump_expression_values' doesn't evaluate undefined
features, only collect actual values.
Fixes: QTBUG-88476
Pick-to: 6.0
Change-Id: I9d09ffbd9f9fa91bc4f36536c58e7f118b06f9b9
Reviewed-by: Alexandru Croitor <alexandru.croitor@qt.io>
Despite being installed in the the binary directory, this
CMake snippet cannot be executed.
Pick-to: 6.0
Change-Id: Ibfd31e51184f0688d19ac063804cc200c95555a7
Reviewed-by: Alexandru Croitor <alexandru.croitor@qt.io>
Before this change, the prl files always assumed that resource object
files are installed into $qt_prefix/lib when doing a prefix build.
That was true for qt_internal_add_resource calls, but not for
qt6_add_qml_module and qt6_target_qml_files.
Change qt_internal_record_rcc_object_files to take a new required
INSTALL_LOCATION argument. The argument takes a path relative
to CMAKE_INSTALL_PREFIX.
Modify __qt_propagate_generated_resource to save the relative path of
the generated resource source file, which will be used in the
computation of the final resource object file location.
This is needed because the Qml resource functions place the source
files in a different directory layout, e.g. .rcc vs .qmlcache
Modify qt_generate_prl_file to prepend $$[QT_INSTALL_PREFIX]/
instead of $$[QT_INSTALL_LIBS]/ for the resource install paths.
A follow up patch is done in qtdeclarative to pass the new
INSTALL_LOCATION argument from the Qml CMake functions.
Amends f9dcade5e7
Task-number: QTBUG-87702
Task-number: QTBUG-88425
Change-Id: Id17bb517b4cb5d00911bfd10a728ba4e0d44871b
Reviewed-by: Qt CI Bot <qt_ci_bot@qt-project.org>
Reviewed-by: Joerg Bornemann <joerg.bornemann@qt.io>
(cherry picked from commit 54d0ca93bca78f8fd31b6761f078e7a96283f183)
Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
Follow the pattern recommended in the CMake docs for the $<JOIN:...>
generator expression. Wrap it in a $<BOOL:...> genex so that if a
target's INCLUDE_DIRECTORIES property is empty, we don't add a
stray -I with no directory following it. This fixes the following error
when running qdoc:
qdoc: Missing value after '-I'.
Pick-to: 6.0
Task-number: QTBUG-88838
Change-Id: Ie3ef2625fbb29cc501f7fc22ff7a9cc8ac548322
Reviewed-by: Alexandru Croitor <alexandru.croitor@qt.io>
If CMake version is 3.19 or greater, use cmake_language(DEFER CALL)
for Qt internal scope finalizers, instead of the homegrown
implementation.
Apart from not depending on the hacky homegrown solution, it
significantly improves the readability of --trace-redirect logs.
Pick-to: 6.0
Task-number: QTBUG-77377
Change-Id: I5ce374bb313865662c536826e86052bc762438b9
Reviewed-by: Joerg Bornemann <joerg.bornemann@qt.io>
On DLL platforms, the value of QMAKE_PRL_TARGET should be the import
library (foo.lib), not the actual DLL (foo.dll). The genex
TARGET_LINKER_FILE_NAME provides exactly that.
Fixes: QTBUG-88864
Pick-to: 6.0
Change-Id: I553930bb840007772fe8f4612f95e0e320f54107
Reviewed-by: Alexandru Croitor <alexandru.croitor@qt.io>
Before CMake 3.19, we are not allowed to query non INTERFACE_ prefixed
property names from INTERFACE libraries. And it was the wrong thing
to do as well. Prefix the properties with INTERFACE_ as appropriate.
Don't try to add INTERFACE_COMPILE_DEFINITIONS from header only
modules to the headerclean compile commands. This causes configuration
issues with UiPlugin in qttools. Fortunately it seems that qmake
doesn't do that for 'header_module's either.
Finally don't query for the FRAMEWORK property on the passed target
(INTERFACE libs can't be frameworks). Instead just query if the whole
Qt build itself is a framework build.
An issue was discovered regarding QT_NO_ENTRYPOINT genexes breaking
headersclean add_custom_commands for UiPlugin in qttools. To avoid
this the property was renamed to all lower case in
6ca66de9120537134b63d42de6c53c6e5834e8f3. This avoided the immediate
issue, but it's possible it might resurface in the future with a
different property name that wasn't renamed. In particular I thought
it might happen with QT_NO_UTF8_SOURCE but it didn't.
In case something like that happens again, the two possible solutions
are to bump minimum CMake version requirement to 3.19 (where upper
case property names are allowed to be queried from INTERFACE libs) or
to implement recursive include directory fetching similar to our
qt_internal_walk_libs implementation.
Pick-to: 6.0
Task-number: QTBUG-86053
Task-number: QTBUG-82615
Change-Id: I7815d555ec9ea049a8fd40f2a2f072dcb9f5e9c3
Reviewed-by: Joerg Bornemann <joerg.bornemann@qt.io>
Query the include dirs from the INTERFACE_INCLUDE_DIRECTORIES property
when generating docs for an INTERFACE library.
Amends 2db41fefa0
Pick-to: 6.0
Task-number: QTBUG-88838
Change-Id: Ic8a454ba66b2dbc59bad883e1e0d38ebb26d0370
Reviewed-by: Cristian Adam <cristian.adam@qt.io>
Restore 'QT_STAGING_PREFIX' logic when generating
'qt-cmake-standalone-test'. Relative paths now calculating depend on
'QT_STAGING_PREFIX'. For prefix builds QT_STAGING_PREFIX should be
prepend to '__qt_cmake_standalone_test_path'
Fixes: QTBUG-88764
Pick-to: 6.0
Change-Id: I655c60847f2ab872948cfe9aedc27835e5cc4fb5
Reviewed-by: Alexandru Croitor <alexandru.croitor@qt.io>
...and include it in QtBuild.cmake.
Commit e8d8b1a5e4 added two different code paths to include
QtBuildInternalsAndroid.cmake.
This was needed, because:
In a top-level build, we must not include files that are not yet
installed. We have the source tree available, and
"${QT_SOURCE_TREE}/cmake" is in CMAKE_MODULE_PATH.
We can use the "module syntax" of the include() command.
In a per-repository build, when building against an installed qtbase, we
must not include files of the source tree, because that's not guaranteed
to be available. However, Qt6BuildInternalsConfig.cmake is installed,
and we can directly include QtBuildInternalsAndroid.cmake, which is
right next to it.
We can circumvent this whole issue by moving the Android-related
functions out of the Qt6BuildInternals package and including it in
QtBuild.cmake.
Pick-to: 6.0
Task-number: QTBUG-88718
Change-Id: I5192ba19bb77952505c20d053d7285f798d16ac5
Reviewed-by: Alexandru Croitor <alexandru.croitor@qt.io>
Commit 9e0fb9c4fb introduced build
failures in non-top-level builds when building Qt modules against
qtbase.
This was observed on in the CI for CentOS.
Partly revert above commit by taking the old code path for non-top-level
builds.
Fixes: QTBUG-88718
Change-Id: I8926e1e4628ec5bdcea99e10497c1f65c10d072d
Reviewed-by: Fabian Kosmale <fabian.kosmale@qt.io>
(cherry picked from commit 510186a218e63c88100efc38cb1611f122f94570)
Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
For consistency, apply the following renamings:
QT_NO_MAKE_EXAMPLES -> QT_BUILD_EXAMPLES_BY_DEFAULT
QT_NO_MAKE_TESTS -> QT_BUILD_TESTS_BY_DEFAULT
QT_NO_MAKE_TOOLS -> QT_BUILD_TOOLS_BY_DEFAULT
BUILD_EXAMPLES -> QT_BUILD_EXAMPLES
BUILD_TESTING -> QT_BUILD_TESTS
This should help to better convey the difference between "BUILD" and
"NO_MAKE".
To configure tests, but not to build them by default, pass the
following to CMake:
-DQT_BUILD_TESTS=ON -DQT_BUILD_TESTS_BY_DEFAULT=OFF
Analoguous for examples:
-DQT_BUILD_EXAMPLES=ON -DQT_BUILD_EXAMPLES_BY_DEFAULT=OFF
Tools can be excluded from the default build with:
-DBUILD_TOOLS_BY_DEFAULT=OFF
The variable BUILD_TESTING is still available and initialized with the
value of QT_BUILD_TESTS.
Pick-to: 6.0 6.0.0
Change-Id: Ie5f29dfbdca8bfa8d687981dfe8c19c0397ca080
Reviewed-by: Alexandru Croitor <alexandru.croitor@qt.io>
Plugins will no longer get .pri files generated in non-static builds.
Header modules are now marked in the .pri files as CONFIG += no_link.
Pick-to: 6.0 6.0.0
Fixes: QTBUG-88221
Change-Id: I06e31fa970ad021261c43ca3acd88055cc4c9555
Reviewed-by: Alexandru Croitor <alexandru.croitor@qt.io>
During a top-level prefix build, while configuring qtsvg,
Qt6BuildInternalsConfig tries to include QtBuildInternalsAndroid.cmake
but such files are not copied by qt_copy_or_install() at configure
time.
We need to use the "module" form of include() to take CMAKE_MODULE_PATH
into account. Then QtBuildInternalsAndroid.cmake can be loaded from the
source tree.
The include's current form was introduced in commit
3cb9ee3a5b without further
explanation. Assuming an accidental change.
Pick-to: 6.0 6.0.0
Task-number: QTBUG-88460
Change-Id: If06ac715fae3c2bebbeffca44b7e07265ffb0f71
Reviewed-by: Alexandru Croitor <alexandru.croitor@qt.io>
Move 'INPUT_' variable detection logic out of
'qt_feature_set_cache_value' function. Use 'INPUT_'
variable to enable/disable related 'FEATURE_' in case if
'FEATURE_' is not defined.
Fixes: QTBUG-88501
Pick-to: 6.0 6.0.0
Change-Id: I1162ac0fb562036898a37b52c3f80229ec8a0970
Reviewed-by: Alexandru Croitor <alexandru.croitor@qt.io>
Add a target for each level-1 subdirectory in a module. Ninja already
generates phony targets such as "qtbase/src/all", but those are not
available in e.g. IDE integrations of CMake. With this addition, targets
like qtbase, qtbase_src, and qtbase_tests are available in IDEs.
Pick-to: 6.0 6.0.0
Change-Id: If1c3369e9413b3ce127e68c443d4d22949708d5e
Reviewed-by: Alexandru Croitor <alexandru.croitor@qt.io>
For shared build, Qt6BundledHarfbuzz.lib and Qt6BundledPcre2.lib are not
installed. But their pri files(qt_ext_harfbuzz.pri, qt_ext_pcre2.pri)
and debug info files(Qt6BundledHarfbuzz.pdb, Qt6BundledPcre2.pdb) are
still installed. These files should not be installed too.
Pick-to: 6.0.0 6.0
Change-Id: I3e54bec01d94ee3897b485a982d01b24edc602aa
Reviewed-by: Alexandru Croitor <alexandru.croitor@qt.io>
Updates due to newer compiler version in QNX7.1
Task-number: QTBUG-88300
Change-Id: If9bbc08d49a077d80174a1807e069b5d4ef61c0d
Reviewed-by: Alexandru Croitor <alexandru.croitor@qt.io>
Use lowercase underscored property names. This ensures they will
continue to work even for INTERFACE libraries if it ever comes to
that.
Change-Id: I5281070f25c1eb9f591c79af8b7fa6169c7c0fb7
Reviewed-by: Joerg Bornemann <joerg.bornemann@qt.io>
This function will be used by qtdeclarative CMake functions to record
resource object file information for Qml-specific generated resources
(like the ones containing qmldir and qml files).
Task-number: QTBUG-87702
Change-Id: I17c295821775d005dea82d9fbdf83d7ee613f615
Reviewed-by: Joerg Bornemann <joerg.bornemann@qt.io>
The CMake build of Qt intends to improve the developer experience in
regards to static Qt builds and Qt resource files. Specifically with a
CMake build of Qt, Qt developers don't have to manually call
Q_INIT_RESOURCE anymore.
For details see the following commits
e343affd63e817ac3d684ab5432081
The last commit's implementation is incomplete though.
To ensure successful linking, each target's prl file should contain
not only the resource object files that are assigned to the target,
but also all resource object files of the target's dependencies.
To achieve that, qt_collect_libs will now recursively collect all
resource object files assigned to the QT_RCC_OBJECTS property of each
dependency.
Note this implementation is still incomplete. We do not export rcc
object file information in the CMake Targets files.
That means that when configuring qtdeclarative in a
non-top-level build, the generated Qml prl file will not
contain references to Core's mimetypes resource object file, etc.
So with the current change, only the object files that are part of the
current CMake configuration build are tracked.
Exporting the resource object files locations proves in a format
usable for prl files proves to be difficult (due to CMake not
supporting exporting genexes in random properties) and will have to be
addressed in a separate change.
Amends 4ab5432081
Task-number: QTBUG-88425
Change-Id: I546655bdfdf7aa86a8df9aadfc054fa415130a33
Reviewed-by: Joerg Bornemann <joerg.bornemann@qt.io>
Refactor the function in preparation of processing rcc object files.
Introduce 2 new functions to get and set values in the memoization
dictionary used by qt_internal_walk_libs.
Modify qt_internal_add_target_aliases to assign the alias names it
creates as properties on the target.
Extract these aliases when available to assign memoized values not
only for the initial library name, but also for its aliases.
When recursively calling qt_internal_walk_libs, make sure to provide a
unique out_var name based on the outer target name, and not just
lib_libs. Otherwise the out_var values would be polluted from
previous recursion runs.
Make sure to check for -NOTFOUND in if() checks so that we reuse
memoized values that are the empty string.
Change-Id: I8fd8e2b0ae14d0ba8f502bc5a764d6e01095001a
Reviewed-by: Joerg Bornemann <joerg.bornemann@qt.io>
In qt_internal_create_module_depends_file we're checking the target
property INTERFACE_MODULE_HAS_HEADERS. However, this property is not
exported, and in per-repo builds we do not have access to this.
As we cannot export INTERFACE_* properties, we export another one,
called _qt_module_has_headers.
This amends commit 598e873c84.
Fixes: QTBUG-88503
Change-Id: I04b3e24add6e95b577a049c80683b7361ff72f59
Reviewed-by: Alexandru Croitor <alexandru.croitor@qt.io>
Make paths in qt-cmake-standalone-test relative to script's PWD.
Fixes: QTBUG-88380
Change-Id: I6ab507c31ebed391f4e85bc6fe3f7f747dd97d54
Reviewed-by: Alexandru Croitor <alexandru.croitor@qt.io>
Without breaking currently generated CMakeLists
Fixes: QTBUG-88549
Change-Id: Ibda643e1374d9024bf693c12de8ec0ac46e09b7b
Reviewed-by: Alexandru Croitor <alexandru.croitor@qt.io>
That breaks configuration with CMake version 3.18.x (but not 3.19 for
some reason).
Specifically configure ends up passing -DCMAKE_CXX_COMPILER=clang++
which overrides the compiler set by the CMake Android toolchain file,
and at the very end of CMake's configuration it complains about
You have changed variables that require your cache to be deleted.
Configure will be re-run and you may have to reset some variables.
The following variables have changed:
CMAKE_CXX_COMPILER= clang++
Which suddenly starts another configuration with the modified
compilers, ends up detecting host compilers and libraries and
basically everything breaks apart.
Fix QtProcessConfigureArgs.cmake not to pass the compiler options if
the mkspec contains 'android'.
Who knows, we might need this for other platforms too at some point.
Task-number: QTBUG-88460
Change-Id: Idd57870a7cb1009a4e7802e5b3d5ac735f2dacf6
Reviewed-by: Cristian Adam <cristian.adam@qt.io>
Although many executable files were generated by qt_internal_add_tool().
Some executable files like designer and androiddeployqt were generated
by qt_internal_add_app(). Some executable files like windeployqt were
generated by qt_internal_add_executable(). For these executable files,
their PDB files won't be installed on MSVC platform, and their separate
debug info won't be generated and installed on other platforms.
To fix this, qt_enable_separate_debug_info() and
qt_internal_install_pdb_files() should also be called in
qt_internal_add_executable().
Fixes: QTBUG-88268
Change-Id: Id6a3b5842dba325166e3d696701c82ad942bca74
Reviewed-by: Alexandru Croitor <alexandru.croitor@qt.io>
Updates one 3rdparty CMake file from
https://github.com/KDE/extra-cmake-modules to include support for
fuzzing.
Task-number: QTBUG-88429
Change-Id: I19e7ed3c5602c34ba4b86e6b0df2ea3047c7c9e6
Reviewed-by: Robert Loehning <robert.loehning@qt.io>
Reviewed-by: Alexandru Croitor <alexandru.croitor@qt.io>
In multi-config build, for different configs, the pdb files of EXEs
should have different installation directories.
For example, when CMAKE_CONFIGURATION_TYPES=RelWithDebInfo;Debug,
<build_dir>/bin/moc.pdb will be installed to <install_dir>/bin/moc.pdb.
<build_dir>/bin/Debug/moc.pdb should be installed to
<install_dir>/bin/Debug/moc.pdb, not <install_dir>/bin/moc.pdb.
Fixes: QTBUG-88268
Change-Id: Idc7c92ca8d44bb81d990656af2b309306a4f5c6b
Reviewed-by: Alexandru Croitor <alexandru.croitor@qt.io>
Android *.so files need to CXX visibility to default after
qt_set_common_target_properties() which was setting it to hidden.
Also, pass the correct androidtestrunner arguments for cmake check
target
Fixes: QTBUG-88228
Change-Id: Ia29cdc9e65153c9669f3ec06f74a46f8fcd8c507
Reviewed-by: Alexandru Croitor <alexandru.croitor@qt.io>
The EntryPoint interface target now contains all the logic
for what flags and optional static libraries to add when the
entrypoint is enabled.
The target property QT_NO_ENTRYPOINT can be used to disable
the entrypoint.
Change-Id: I9b14ff729366cd6307789c969ebd4b2ca19de77d
Reviewed-by: Qt CI Bot <qt_ci_bot@qt-project.org>
Reviewed-by: Alexandru Croitor <alexandru.croitor@qt.io>
Fix the overly strict regex in qt_internal_create_module_depends_file to
allow for - and _ in module names.
We had the above mentioned dependency cycle, because the module name
Core_qobject was translated to just Core, creating a Core -> Core
dependency.
Amends da7609e7d0.
Fixes: QTBUG-88437
Change-Id: I866f7ce31e9a1b92fe4c0a6450295c2f3c761558
Reviewed-by: Tor Arne Vestbø <tor.arne.vestbo@qt.io>
Since feature evaluation expects explicit 'no' value for INPUT_opengl
to disable either desktop or es2 opengl support, add special
processing for -no-opengl option into QtProcessConfigureArgs.cmake
Task-number: QTBUG-88142
Change-Id: Ib49123ee3e9f98035f6ec85a182382559f4db478
Reviewed-by: Alexandru Croitor <alexandru.croitor@qt.io>
All configure arguments should be processed as strings
and not be ignored if they satisfy CMake's FALSE criteria
(see https://cmake.org/cmake/help/latest/command/if.html)
Fixes: QTBUG-88424
Change-Id: I932038ad3c5999bed58957dec51fbf892bd650d7
Reviewed-by: Alexandru Croitor <alexandru.croitor@qt.io>
This reverts commit 9968a211f9.
The PKG_CONFIG_* environment variables should be added by the user
environment, preferably by the toolchain file.
Apparently, the change was added for Android before we turned off
pkg-config for Android. It is not needed anymore.
Change-Id: Ieeed09ae53a606c85d4937f463286b5b0f76bde9
Reviewed-by: Alexandru Croitor <alexandru.croitor@qt.io>
According to Microsoft's docs, /OPT:ICF is enabled by the
linker by default unless /OPT:NOICF or /DEBUG is specified.
If we are in RelWithDebInfo mode, /DEBUG is passed to the
linker to generate debug symbols, however, it caused the
identical COMDAT folding be disabled. We now pass /OPT:ICF
to the linker explicitly to prevent this.
[1] https://docs.microsoft.com/en-us/cpp/build/reference/opt-optimizations?view=msvc-160
Change-Id: I02099edb81034ace7bb19f1164d57829e3979a5f
Reviewed-by: Alexandru Croitor <alexandru.croitor@qt.io>
We need to handle the possibility of versioned dep (Qt6::Foo).
Change-Id: I66797dbc59f00500892958e9c99c4555cddcb980
Reviewed-by: Alexandru Croitor <alexandru.croitor@qt.io>
If not, the resulting dep would end up as 'Foo>', but we need 'Foo'.
Change-Id: I246b66eb0ac6b076eea200c4d1ad84bba8ed179c
Reviewed-by: Alexandru Croitor <alexandru.croitor@qt.io>
*Not* using /permissive- exposes Qt and client apps to interesting
bugs and/or build failures, (e.g. QTBUG-87225, or
19b5520abf). We demand strict
conformance by any other compiler, it's time to demand it from
MSVC too.
The Windows headers themselves are clean starting from the
Windows Fall Creators SDK (10.0.16299.0), and moreover Qt 6 will
drop WinRT; therefore, the comment in the mkspecs does not apply
any more.
Since /permissive- implies /Zc:referenceBinding, drop that
option. The other implied options are set on MSVC < 2017,
but I leave them in to avoid tinkering with the fragile lists
of C/C++ flags.
Rename the CMake internal helper function to better describe
what it does.
Fixes: QTBUG-85633
Fixes: QTBUG-85637
Fixes: QTBUG-85635
Fixes: QTBUG-88244
Change-Id: Ie03fddb61aa066fdc14b7231c22e7108b4a02fbb
Reviewed-by: Friedemann Kleint <Friedemann.Kleint@qt.io>
Reviewed-by: Kai Koehne <kai.koehne@qt.io>
Reviewed-by: Volker Hilsheimer <volker.hilsheimer@qt.io>
In the qmake-based build, the hostdatadir is the directory where "Data
used by qmake" is located. In the CMake build the equivalent is
INSTALL_MKSPECSDIR. Create the mapping accordingly.
Fixes: QTBUG-88211
Change-Id: I9e3d1af24bc7f41333ef2269fced5ab3fcfa848d
Reviewed-by: Alexandru Croitor <alexandru.croitor@qt.io>
Previously, QtDocsHelpers.cmake was invoking CMake to copy
files or directories instead of using installation targets.
This resulted in DESTDIR being ignored.
Now we create installation targets and ask CMake to
install them.
Change-Id: Idbc79d47a37f9ca865d28543bdbbdde3ba448fa3
Fixes: QTBUG-87382
Reviewed-by: Alexandru Croitor <alexandru.croitor@qt.io>
Extend qt_configure_get_padded_string to make the feature list look like
qmake's.
Fixes: QTBUG-88144
Change-Id: I714f2b2f3537b506365a03b5b6bc3413e9cab167
Reviewed-by: Alexandru Croitor <alexandru.croitor@qt.io>
For now, we only support building Qt with the Ninja generator (and
Ninja Multi-Config).
Issue a warning when a different generator is used.
Allow opting out of the warning by passing
-DQT_SILENCE_CMAKE_GENERATOR_WARNING=ON.
Change-Id: I5faa5b0ca5fd42efc090ad2ccf4f896bd77e50ca
Reviewed-by: Joerg Bornemann <joerg.bornemann@qt.io>
In configure we need to set the Release configuration first to make it
the main configuration.
Change-Id: I5fe744b0dcea009c4d672bf519b38c80c87475dd
Reviewed-by: Alexandru Croitor <alexandru.croitor@qt.io>
In multi-config builds (which equals the debug-and-release feature) we
exclude tools of the non-main configurations from the default build.
But we still create installation rules for them. Mark those as optional
to avoid "cmake --install" yielding errors if those tools weren't built.
Fixes: QTBUG-85411
Change-Id: Ic2d3897d1a1c28a715d9a024ec8606fff00e0315
Reviewed-by: Alexandru Croitor <alexandru.croitor@qt.io>
Make zstd config based lookup quiet and check for version variable
as required for ZSTD target.
Add IMPORTED_LOCATION by default for pkg-config based search.
Expect that select_library_configurations will set correct value
for ZSTD_LIBRARY.
Fixes: QTBUG-88091
Change-Id: Ia5079154ce4fc4eefbc0931317219b5ca0f3f82f
Reviewed-by: Alexandru Croitor <alexandru.croitor@qt.io>
Modify pro2cmake converter to add extra argument to
qt_internal_add_plugin. DEFINE_IF FALSE is added to generic plugins
those had "PLUGIN_EXTENDS = - " specified in .pro files.
Fixes: QTBUG-87861
Change-Id: I9269df19a32a088f5261f50e7ffff6d29c3d605f
Reviewed-by: Alexandru Croitor <alexandru.croitor@qt.io>
The QT.foo.module entry is used for linkage, so we shouldn't
add it for header only modules.
Change-Id: Ibb6e7ab08083ccab11d7e060f35c54153e3751c0
Reviewed-by: Alexandru Croitor <alexandru.croitor@qt.io>
For non-cross-builds, qt-configure-module is located in
CMAKE_INSTALL_PREFIX/bin, not below the staging prefix.
Fixes: QTBUG-88262
Change-Id: Ib6cdd88ece391d5b8ce850b991564e5bed1e475d
Reviewed-by: Alexandru Croitor <alexandru.croitor@qt.io>
If the user turns on debug_and_release with the configure script,
FEATURE_debug_and_release will not be set, and the debug postfix won't
be set correctly.
Directly use FEATURE_debug_and_release's condition instead.
Change-Id: Ica4af3caa25f2e6712eca4659818aac2c8b95256
Reviewed-by: Alexandru Croitor <alexandru.croitor@qt.io>
Configure now translates -developer-build to INPUT_developer_build
without setting FEATURE_developer_build.
The install prefix determination code in QtSetup.cmake happens much
earlier than the feature evaluation. As the developer_build feature is
merely a switch that's supposed to be flipped by the user, we can just
translate the INPUT_developer_build value to FEATURE_developer_build in
QtSetup.cmake.
Fixes: QTBUG-88318
Change-Id: I57918232359e2e367e41b779d3f4737731dd76e5
Reviewed-by: Alexandru Croitor <alexandru.croitor@qt.io>
Trying to locate zstd package configuration prior to use pkg-config.
Define explicit IMPORTED_LOCATION_DEBUG and IMPORTED_LOCATION_RELEASE
in case of pkg-config usage.
Fixes: QTBUG-88091
Change-Id: I3cb86a66fad4e7b78b3d2fcff061508fc25e25a7
Reviewed-by: Alexandru Croitor <alexandru.croitor@qt.io>
Use select_library_configurations to select applicable libraries
set for PCRE2.
Fixes: QTBUG-88092
Change-Id: I11e669a0142d53a3c344c86bd1d8eb797df4ba97
Reviewed-by: Alexandru Croitor <alexandru.croitor@qt.io>
Some repos (like qtimageformats) might not have Qt modules, but they
still need a target to pass to qt_internal_add_docs().
Allow passing custom targets to qt_internal_add_docs() without trying
to generate bogus include paths.
Change-Id: I12191e5b16c082e62e40c96d0eb4d6c0256e7ea4
Reviewed-by: Cristian Adam <cristian.adam@qt.io>
"ninja install_docs" should not run the "docs" target, because with
the usual workflow
ninja docs
ninja install_docs
the documentation would be built twice.
That of course means that "ninja install_docs" will fail if "ninja
docs" wasn't run before.
Analogous for html_docs, qch_docs, the repository-level and
module-level documentation targets.
Change-Id: I8ad83602dd393b5afc79a19ab3d395987c889d0d
Reviewed-by: Alexandru Croitor <alexandru.croitor@qt.io>
The following targets did not do any actual installation:
install_docs, install_html_docs, install_qch_docs,
plus their repository-level counterparts.
Add the following dependencies:
install_html_docs
--> install_html_docs_<repo>
--> install_html_docs_<module>
Analogous for qch.
The install_docs target already triggers install_html_docs and
install_qch_docs. Analogous for install_docs_<repo>.
Fixes: QTBUG-86738
Change-Id: I3468e000e050e2787a859e61d40161f5459cb351
Reviewed-by: Alexandru Croitor <alexandru.croitor@qt.io>
Tools and library DLLs already have version information embedded.
Add the missing _qt_internal_generate_win32_rc_file call for plugins.
Fixes: QTBUG-87747
Change-Id: I619948f4066ce229d41e8b93f125751e1d28e26c
Reviewed-by: Cristian Adam <cristian.adam@qt.io>
Reviewed-by: Alexandru Croitor <alexandru.croitor@qt.io>
INPUT_ variables enable FEATURE_ variable only in case if valid
"true"-like value is assigned from command line.
Amends dc43061e9a
Fixes: QTBUG-87755
Task-number: QTBUG-88142
Change-Id: I65e85c7548981fdec94366b531f6df6396be71b7
Reviewed-by: Alexandru Croitor <alexandru.croitor@qt.io>
We have some cache variables that are used in our qt.toolchain.cmake
toolchain file, for example QT_CHAINLOAD_TOOLCHAIN_FILE. When CMake
runs a configure test with try_compile, our toolchain file is included
again, but only a restricted set of variables is available.
Add the variables that are used in our internal toolchain file to
CMAKE_TRY_COMPILE_PLATFORM_VARIABLES. This makes them visible for
try_compile calls operating on source files.
Also pass the variables via the environment to support try_compile
calls that operate on whole projects.
Fixes: QTBUG-87873
Change-Id: Iebca9e23686bec5072194b15482e1782b9367a0e
Reviewed-by: Alexandru Croitor <alexandru.croitor@qt.io>
These were omitted in the original change, which cause cmake builds to
fail configuring
Change-Id: I37996099aaa0d912ce06b1f06c175cc5cf159e33
Reviewed-by: Joerg Bornemann <joerg.bornemann@qt.io>
This matches how it is in the qmake mkspec, silencing a lot of
warnings - but contrary to when building with qmake, it's only
applied when building Qt itself. For external projects built with
cmake, the Qt headers are included with -isystem, which silences any
warnings from those headers.
Change-Id: I1a498d3c2715cb73e647668cb7226ceeffb7ff0b
Reviewed-by: Alexandru Croitor <alexandru.croitor@qt.io>
Now all shared libraries and executables will get .debug files on
the platforms that support FEATURE_separate_debug_info
With the directory property _qt_skip_separate_debug_info certain
targets can retain the debug symbols in the binary e.g. lupdate with
MinGW 8.1.0 will cause objcopy / strip to fail.
Fixes: QTBUG-87015
Change-Id: I03b106e68ef0a42011d1ba641e6f686b2e7b7fb4
Reviewed-by: Alexandru Croitor <alexandru.croitor@qt.io>
"configure" script translates feature-related parameters to INPUT_
variables instead of FEATURE_.
Both INPUT_ and FEATURE_ variables passed to cmake script are
equivalent. FEATURE_ has higher priority in case if both are defined.
Fixes: QTBUG-87755
Change-Id: If697a0d62ab839877a3196ea74e631582a570dda
Reviewed-by: Alexandru Croitor <alexandru.croitor@qt.io>