qt5base-lts/cmake/PkgConfigLibrary.pc.in
Martin Reboredo 5b07f14a4f CMake build: generate pkgconfig for public modules
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>
2022-02-28 08:39:54 -03:00

14 lines
510 B
PkgConfig

prefix=@CMAKE_INSTALL_PREFIX@
exec_prefix=${prefix}
bindir=${prefix}/@INSTALL_BINDIR@
libdir=${prefix}/@INSTALL_LIBDIR@
includedir=${prefix}/@INSTALL_INCLUDEDIR@
$<$<BOOL:@contains_mkspecs@>:mkspecsdir=${prefix}/@INSTALL_MKSPECSDIR@>
$<1: >
Name: @pkgconfig_name@
Description: @pkgconfig_description@
Version: @PROJECT_VERSION@
Libs: $<$<NOT:@is_interface_library@>:-L${libdir} -l@pkgconfig_file@> @link_options@
Cflags: @include_dirs@ @compile_defs@
Requires: $<JOIN:$<REMOVE_DUPLICATES:@target_requires@>, >