Create Qt:: versionless targets for libraries and tools. So
Qt::Core will link to Qt5::Core.
Add additional feature properties to targets, with the same name
they have in Qt6: QT_ENABLED_PUBLIC_FEATURES,
QT_DISABLED_PUBLIC_FEATURES, QT_ENABLED_PRIVATE_FEATURES,
QT_DISABLED_PRIVATE_FEATURES, to be forward-compatible with Qt6.
Prefix properties with INTERFACE_ for interface libraries.
Create functions with no major version in their prefix, so qt_foo
instead of qt5_foo.
The non-versioned functions will call the versioned functions,
depending on the value of QT_DEFAULT_MAJOR_VERSION, which can be
set by an application developer before finding the Qt package.
Set QT_DEFAULT_MAJOR_VERSION to 5 if the value has not been defined
in the current scope.
Application developers can set QT_NO_CREATE_VERSIONLESS_FUNCTIONS to
TRUE before calling find_package(Qt5) to suppress creation of the
non-versioned functions.
Application developers can set QT_NO_CREATE_VERSIONLESS_TARGETS to
TRUE before calling find_package(Qt5) to suppress creation of the
non-versioned targets.
Setting these can be useful when both find_package(Qt5) and
find_package(Qt6) are in the same project.
If none of these are set by the user, then the first find_package(Qt5)
will create versionless targets with the major version being "5",
which means the second find_package(Qt6) will not create versionless
targets.
Handle versionless plugin names in qt_import_plugins, so both
Qt::QCocoaIntegrationPlugin and Qt5/6::QCocoaIntegrationPlugin
are recognized by the function.
Allow specifying multiple types in EXCLUDE_BY_TYPE in
qt_import_plugins, to be consitent with the Qt 6 version.
Make sure to set the QT_PLUGIN_CLASS_NAME property to compatible with
Qt 6.
Task-number: QTBUG-74137
Task-number: QTBUG-80477
Change-Id: Ib89d090ea6f7794d7debd64f03f29da963a17ca7
Reviewed-by: Joerg Bornemann <joerg.bornemann@qt.io>
Only expect debug Qt libs with 'd' suffix if Qt was configured with
-debug-and-release.
This partially amends 9b4ec1393f and 4d289edb1 .
Fixes: QTBUG-81325
Change-Id: I56c8965272265cf0a91351aae29d648b8687ec77
Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
Reviewed-by: Joerg Bornemann <joerg.bornemann@qt.io>
CMake mkspec feature sets CMAKE_PRL_FILE_LOCATION_* values inconsistent
with actual .prl file names being generated/installed, causing
dependency extraction mechanism in Qt5BasicConfig.cmake.in to not work
(function _qt5_$${CMAKE_MODULE_NAME}_process_prl_file silently fails
to find file at given location and skips filling libs deps).
[ChangeLog][CMake][Windows] Fixed linking with Qt static build
Fixes: QTBUG-81401
Change-Id: I5861cc0c42163d898ba55ad83cbad1994dcb1db2
Reviewed-by: Alexandru Croitor <alexandru.croitor@qt.io>
If an app wants use a debug framework of Qt, it is still expected that
the app should link against the release version, and just set
DYLD_IMAGE_SUFFIX=_debug when running the app.
This was not the case before, where the CMake Config files told CMake
to link explicitly against the debug libraries. This caused crashes
due to the Qt plugin loader mechanism still trying to find a release
platform plugin, which in turn would load release libraries, and thus
the application would end up loading both debug and release plugins.
Make sure the Config files in a framework case always reference the
release libraries (even though this might be counter intuitive).
Otherwise users of the Debug Config files would always get
crashes.
Fixes: QTBUG-78131
Change-Id: I88b1dc421477ad186012ca67b328a891128eb568
Reviewed-by: Cristian Adam <cristian.adam@qt.io>
Reviewed-by: Tor Arne Vestbø <tor.arne.vestbo@qt.io>
As was recently discovered, the debug_and_release CONFIG value is
always true on Windows, even if the feaure is disabled when specifying
-debug or -release when configuring Qt.
In order for the generated CMake Config files to be correct, we need
to use the true feature value.
Amends 44602224bf.
Change-Id: I42be684e8ad2a5ce72cb2e9d36f81de7589112c6
Reviewed-by: Jörg Bornemann <joerg.bornemann@qt.io>
If Qt is configured with -release or -debug we must set CMAKE_DEBUG_TYPE
or CMAKE_RELEASE_TYPE, but not both.
This was broken by 82a2c7df which fixed the issue for iOS
simulator_and_device builds.
We have the following situation for both relevant CONFIG values:
debug_and_release build_all
iOS simulator_and_device unset set
Windows -release set unset
Windows -debug-and-release set set
Trivia: On Windows, when configuring with -release (or -debug) then
the *feature* debug_and_release is not set.
The *CONFIG* *value* however, is unconditionally set in
msvc-desktop.conf.
Fixes: QTBUG-77754
Change-Id: I326ecb024056bc189be5fa03ec6f59bc71226544
Reviewed-by: Alexandru Croitor <alexandru.croitor@qt.io>
create_cmake.prf populates the values of CMAKE_RELEASE_TYPE and
CMAKE_DEBUG_TYPE depending on if Qt was configured with debug, or
release, or the build_all feature was set (which implies
debug_and_release).
simulator_and_device also implies build_all. This
is a problem when configuring a Qt simulator_and_device build with
only a "debug" configuration, or only a "release" configuration.
In that case we would try to parse prl files for both configurations,
even though only one configuration exists.
Switch to checking for debug_and_release scope explicitly instead of
build_all. This allows configuring and building a Qt iOS
device_and_simulator debug configuration which is usable from CMake.
Task-number: QTBUG-38913
Change-Id: Ife6d5d34d2b6bb1ac787d901a166e41c6e0c844b
Reviewed-by: Jörg Bornemann <joerg.bornemann@qt.io>
This commit adds transitive dependencies to the plugins, so that a
sane set of default plugins get auto-imported when linking against a
module. It also provides a new function, qt5_import_plugins(), which
allows you to override the set of plugins that get imported. The decision
of whether or not to import a specific plugin is based on several custom
target properties and a very clever generator expression.
Note that this change only imports plugins on static Qt builds. It
does nothing on shared Qt builds, as the shared libraries already have
their own plugin import mechanism.
[ChangeLog][CMake] Added ability to auto-import non-qml plugins on
CMake builds
Task-number: QTBUG-38913
Task-number: QTBUG-76562
Change-Id: I2d6c8908b521cf6ba1ebbbc33a87cb7ddd9935cf
Reviewed-by: Simon Hausmann <simon.hausmann@qt.io>
After commit 9c7ebd191b, qmake would
complain about missing cmake tests even for internal modules that have
no application side C++ linkage that needs testing.
Change-Id: I23b23c81dbe6be2b6da5672cbd7b8f8454ec2f66
Reviewed-by: Alexandru Croitor <alexandru.croitor@qt.io>
This change will create Config.cmake files for internal modules like
AccessibilitySupport when doing static builds. They need to be
find_package()'ed and linked in when linking in certain qt plugins.
Task-number: QTBUG-38913
Task-number: QTBUG-76562
Change-Id: Ia2e446025c87df48f20bb65cfd9da6c6a4354bb1
Reviewed-by: Simon Hausmann <simon.hausmann@qt.io>
When adding the static dependencies for a module, they should be
added to the debug|release configuration as appropriate, otherwise
it ends up adding the debug version of the libraries to the release
configuration as well as the release version of the libraries.
Implementation wise, that means we have to use generator expressions
of the form $<$<CONFIG:Configuration>:${dependencies}>, because
INTERFACE_LINK_LIBRARIES does not have a
INTERFACE_LINK_LIBRARIES_<CONFIG> equivalent that can be set per
configuration.
Note that the condition part of the generator expression can not
explicitly check for Debug or for Release, because a user can
configure their application without specifying CMAKE_BUILD_TYPE,
which means that both Debug and Relase conditions would fail.
So the actual condition has to be isDebug or isNotDebug.
The same approach is used for INTERFACE_LINK_OPTIONS.
For debug_and_release builds we use the isDebug and isNotDebug
conditions for the generator expressions.
For singular builds (only release or only debug), we set the
generator expression condition to "1" aka always true.
This means that the Qt libraries and link options will always be used
regardless of the configuration with which the CMake application
is configured with.
Fixes: QTBUG-76337
Task-number: QTBUG-38913
Change-Id: I5369d8ba083359a4a92253dbd1dabe9d1efa34db
Reviewed-by: Andy Shaw <andy.shaw@qt.io>
The paths to the libraries and prl files should have the "_debug"
suffix for the debug configuration. This prefix is added to the TARGET
when by qt_module.prf when doing a debug build, but not during a
debug_and_release build.
Make sure to strip the _debug suffix if it's there, and re-add it later
always, to be consistent in both debug_and_release builds and in
debug builds.
Amends a12b6e7bf6.
Task-number: QTBUG-38913
Task-number: QTBUG-75520
Change-Id: I29e88f2b991e2be06b23652d64edc768fa35a5ae
Reviewed-by: Jörg Bornemann <joerg.bornemann@qt.io>
CMAKE_QT_STEM already contains the _debug suffix.
Do not add it again.
This amends commit bb8a3dfc.
Fixes: QTBUG-75520
Change-Id: I6c311f0913ea83fcf299a21a0ee1f28c3861371f
Reviewed-by: Kai Koehne <kai.koehne@qt.io>
This is a follow-up to f5850cb0da, which
did not take into account some special-casing for macOS framework build,
thus causing CMake to look for QtFoo.framework instead of Foo.framework.
Change-Id: I261b14e75fde66fb57486bde43fc936f796a6f96
Reviewed-by: Joerg Bornemann <joerg.bornemann@qt.io>
Reviewed-by: Kevin Funk <kevin.funk@kdab.com>
When such modules aren't following the libQt5Foo.so naming convention,
the generated CMake files would be incorrect.
Change-Id: I57908f7466bff7a05f19271ccd495849476bdf38
Reviewed-by: Simon Hausmann <simon.hausmann@qt.io>
Reviewed-by: Paul Lemire <paul.lemire@kdab.com>
Reviewed-by: Joerg Bornemann <joerg.bornemann@qt.io>
Reviewed-by: Kevin Funk <kevin.funk@kdab.com>
We need to make sure we don't emit CMake declarations for private
headers if those headers are absent. However, most of the time we have
private headers and should add them.
Task-number: QTBUG-37417
Change-Id: I639eb93d008de27928dedac540894af70c1883b9
Reviewed-by: Oswald Buddenhagen <oswald.buddenhagen@qt.io>
the only users of module versions in the first place are found within
qt's own prfs; even qbs' qt module importer ignores them. but arguably,
the information makes sense.
however, exporting the same barely useful information redundantly is
plain over the top, so remove the pre-split representation.
Change-Id: Iaee69c86d8b7c8b8ef4f3580b8da333aeb8ade2c
Reviewed-by: Joerg Bornemann <joerg.bornemann@qt.io>
It's only used in one place, where it's actually not required either.
Change-Id: I5766d2b5f0c1083bbd58a9b9fb07cc67bbd46a94
Reviewed-by: Oswald Buddenhagen <oswald.buddenhagen@theqtcompany.com>
The platform has been removed in Qt 5.7.
Change-Id: Ie768b5ffbe60270c27b4a670dcf580ea361cb361
Reviewed-by: Oswald Buddenhagen <oswald.buddenhagen@theqtcompany.com>
just like in qt_plugin.prf, the DESTDIR setting is actually fixed per
module type.
Change-Id: I5837b5884699f0d50e4067733af8aacbab93bc42
Reviewed-by: Stephen Kelly <ske@ableton.com>
Require CMake 3.0 if an attempt is made to use a cmake file containing
an INTERFACE library.
If the user is using a CMake version older than 3.0, then exclude INTERFACE
libraries from dependencies of Qt modules. The Qt CI system is running
CMake versions as old as 2.8.11, which makes that the current minimum version.
The only header-only module existing so far is the QtUiPlugin module, which
has been split out from the QtDesigner module. If using CMake 2.8, the
forwarding headers in the QtDesigner module will be used, and the effect
of the split out library will not be seen. If using CMake 3.0, the
split out library is listed as a dependency and its transitive usage
requirements such as the QT_UIPLUGIN_LIB definition are made available.
Change-Id: Iecee3bbc440842dca27dc067f2a31e3526efa01b
Reviewed-by: Oswald Buddenhagen <oswald.buddenhagen@theqtcompany.com>
We need PIE, doesn't matter if reduce_relocations is used or not
Change-Id: I9a359b9d4443a6059980cd4c48058132ec4267fe
Reviewed-by: Simon Hausmann <simon.hausmann@theqtcompany.com>
Reviewed-by: Olivier Goffart (Woboq GmbH) <ogoffart@woboq.com>
MinGW static libs use libfoo.a format, and not foo.lib.
Change-Id: I899adca8ec0b1c8430f5b6c4f18ad0ea1dc6d398
Reviewed-by: Timothy Gu <timothygu99@gmail.com>
Reviewed-by: Oswald Buddenhagen <oswald.buddenhagen@digia.com>
Giving instructions, rather than forcing one to grep qtbase for the error
message is always a good thing.
Change-Id: I0f5abed341368cdf817dc0110c2c250b377a30de
Reviewed-by: Oswald Buddenhagen <oswald.buddenhagen@digia.com>
Webkit has a different layout, so allow the tests to be found in
the appropriate location.
Change-Id: Iedbea6daada98a3c3efdbcfc1fe4df5d2c8cea6a
Reviewed-by: Oswald Buddenhagen <oswald.buddenhagen@digia.com>
a162a3cb (Android: Add "unversioned_libname" configuration, 2014-04-23)
removed the version for shared libs on Android. This change updates
the generated CMake files to support that.
Change-Id: Ia6ef04872c664bd4c31546456a82730babed2910
Reviewed-by: Oswald Buddenhagen <oswald.buddenhagen@digia.com>
Reviewed-by: Stephen Kelly <stephen.kelly@kdab.com>
instead of assigning plugins to the first module which claims the whole
type, try to assign it to a module which the plugin claims to extend.
as we are getting stricter in that go, somebody needs to claim the
'generic', 'platformthemes', and 'platforminputcontexts' plugin types.
the natural claimant is QtGui. however, as we don't want to auto-link
any of these plugins, make them all claim that they extend a
non-existing module.
QtGui also claims 'iconengines' plugins.
the 'printsupport' plugins are also claimed by the respective module.
Change-Id: I7af7c16089f137b8d4a4ed93d1577bd85815c87b
Reviewed-by: Jørgen Lind <jorgen.lind@digia.com>
Reviewed-by: Joerg Bornemann <joerg.bornemann@digia.com>
Reviewed-by: Oswald Buddenhagen <oswald.buddenhagen@digia.com>
Commit 773dd01 introduced a general mingw platform scope, which
is cleaner and more flexible than matching the spec name.
Change-Id: Ie3a9cb791a83f7c8a51bc4e23069190c452ab521
Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
the module project files declare what plugins they need, as that is
necessary for automatic android deployment.
enable wider usage of this by making the information available from the
module .pri files.
caveat: the variable is called "types", but is in fact paths, so there
can be particular plugins named.
use this new facility to replace the egregious hard-coded list of
plugin-to-module mappings from create_cmake.
possible todo: automate populating DEPLOYMENT (for wince, and whatever
else).
Change-Id: Ibb9c07cfe2b0008905204cbeb81e9c8e2ae4dc69
Reviewed-by: Joerg Bornemann <joerg.bornemann@digia.com>
instead of being magic attributes of the main modules, the privates
are now proper modules of their own.
this cleans up some code paths, is more mappable to other build tools,
and enables private modules to depend on other private modules.
note that the library path is needed even in the "empty" private
modules, as in the framework case that's where headers are found.
consequently, the modules need to be explicitly marked with the new
"no_link" flag. this required some reorganization of qtAddModule().
Change-Id: I8e4f44a609f8d639cc01bcb658256870a627eb63
Reviewed-by: Joerg Bornemann <joerg.bornemann@digia.com>
Change-Id: I2e874af4f5bf22a3028b7099c39436c400136386
Reviewed-by: Oswald Buddenhagen <oswald.buddenhagen@digia.com>
Reviewed-by: Stephen Kelly <stephen.kelly@kdab.com>
The source includes shouldn't be used by installations, so
don't install the extra file, but only use it if the package
is used from the build-dir.
Task-number: QTBUG-33970
Change-Id: I08f91b8a716e935cb04d1233d44cf5c092e240ce
Reviewed-by: Oswald Buddenhagen <oswald.buddenhagen@digia.com>
Reviewed-by: Stephen Kelly <stephen.kelly@kdab.com>
The DLLDESTDIR is not related to the install location and is not
populated for prefix_build configurations.
That resulted in the CMake files attempting to find the dlls in the lib/
directory instead of the bin/ directory.
Change-Id: Iec6a7c9b6dd656278b70ab128f3df9e8c45bbe4a
Reviewed-by: Oswald Buddenhagen <oswald.buddenhagen@digia.com>
The cmake directory may not be $PREFIX/lib/cmake, but
instead $PREFIX/lib/<arch>/cmake. Getting the PATH of such a
directory will not lead us to $PREFIX/, but to $PREFIX/lib.
Use a relative calculation instead.
Task-number: QTBUG-33223
Change-Id: Ice4e0f859ab1df238bad4eb942f073e84dd86cc3
Reviewed-by: Oswald Buddenhagen <oswald.buddenhagen@digia.com>
Reviewed-by: Lisandro Damián Nicanor Pérez Meyer <perezmeyer@gmail.com>
Reviewed-by: Stephen Kelly <stephen.kelly@kdab.com>