The gc_sections linker flag was recently wrapped in a
$<CXX_COMPILER_ID> genex to prevent adding it the command line when
using an incompatible compiler.
This causes an issue when generating .pc pkg-config files because
$<CXX_COMPILER_ID> can't be used in the output of a file(GENERATE)
call.
Record the flag in a global property, both the genex-wrapped and bare
forms, so that we can perform a string replacement when generating
the pkg-config file to remove the genex wrapping.
This is not perfect, in the sense that consumers of the .pc file
might get the wrong flag if using an incompatible compiler, but
it's better than outright failing the Qt build.
Distros will be expected to patch the .pc files if necessary.
Note the issue does not usually happen for regular Qt builds because
gc_sections is only enabled automatically for static builds, but for
static builds we don't currently generate .pc files.
So the issue only happens in shared Qt builds where the gc_sections
feature is enabled manually.
Amends a2b6c2f343
Pick-to: 6.5 6.6
Fixes: QTBUG-115243
Change-Id: I3f6bdf86c24ee90b6da04994e458b438cc41fc7a
Reviewed-by: Amir Masoud Abdol <amir.abdol@qt.io>
We decided that it's better to disable PkgConfig for Android, as it is
unlikely that someone uses them.
Task-number: QTBUG-110007
Pick-to: 6.5 6.4 6.3 6.2
Change-Id: I6ae1059ddd05feeec047fbb906c7dba1586e816b
Reviewed-by: Alexey Edelev <alexey.edelev@qt.io>
CMakeLists.txt and .cmake files of significant size
(more than 2 lines according to our check in tst_license.pl)
now have the copyright and license header.
Existing copyright statements remain intact
Task-number: QTBUG-88621
Change-Id: I3b98cdc55ead806ec81ce09af9271f9b95af97fa
Reviewed-by: Jörg Bornemann <joerg.bornemann@qt.io>
When generating .pc files there is a warning when executing
QtFinishPkgConfigFile.cmake:
Ignoring empty string ("") provided on the command line.
This happens because the 'postfix' argument is a part of the script
command line even if it's empty. It also makes no sense to check if
'postfix' is empty using genex, use configuring-time check instead.
Pick-to: 6.2 6.3
Change-Id: If52d9634f4885caefb828976b3c99592a6db3d3c
Reviewed-by: Alexandru Croitor <alexandru.croitor@qt.io>
Conditions with the LINK_LANGUAGE genex are not parsed correctly when
generating .pc file. So link options will be added unconditionally.
Amends d1e02c3855
Pick-to: 6.2 6.3
Fixes: QTBUG-101723
Change-Id: Ib837b3f3429d195a469450ef25af9630ad7d15e2
Reviewed-by: Alexandru Croitor <alexandru.croitor@qt.io>
After the update to the CMake based build system the ability to
generate pkgconfig files, like it was with QMake, was lost.
This patch adds pkgconfig generation again via a new internal command
named qt_internal_export_pkg_config_file.
The functionality of this command consists in checking if the target
is internal. Then gets the compile definitions. It performs a search
for dependencies that is somewhat similar to
qt_get_direct_module_dependencies, although it won't recurse down for
more deps. Each dependency is then again, checked if it's internal or
has a public interface. Later these deps get deduplicated and lastly
a pkgconfig file is filled.
The resulting pkgconfig files of many of the Qt6 packages were
validated via invocations of `pkg-config --validate` and
`pkg-config --simulate` commands and later used to build local
projects plus tests that use the pkg-config provided details at
compilation time.
Although it has some limitations, with qt_internal_add_qml_module if
it specifies non-public deps these won't be listed and with non-Qt
requirements, notably in static builds, not being appended to the
PkgConfig file.
Task-number: QTBUG-86080
Change-Id: I0690bb3ca729eec328500f227261db9b7e7628f6
Reviewed-by: Alexandru Croitor <alexandru.croitor@qt.io>