Status: In Progress
Priority: P2: Important
Affects Version/s: 6.0.0
Fix Version/s: None
Component/s: Build System: CMake
When using a static Qt, we can't build examples as part of the main Qt build due to issues with cyclic dependencies between the main Qt module libraries and the plugins (see
QTBUG-90819). We would have to manually link to the plugins in every example, but this is something that user projects wouldn't need to do and the examples would then be tainted with things that are only relevant to building Qt itself.
Ideally, we want the examples to be built in their own separate build. They should build against the Qt that the main build provides somehow. A potential solution to this is to move the examples out to their own test case(s) and make use of the ctest --build-and-test functionality. That ctest feature is specifically meant for situations like this, where you want to verify that a project can be configured and built.
While it would be nice to make every single example its own separate test case, that would have a fairly strong negative impact on test time. Every sub-build will need to do a full CMake run, which means performing compiler checks, etc. and this can take several seconds with some generators. We can minimise this impact by grouping examples by functionality, feature, etc. such that one test case builds multiple examples. We could potentially offer a CMake option for fine-grained tests if the user wanted it.
Tests support labels in CMake. We could potentially assign some labels based on the module, etc. for each example or group of examples. This would enable the developer to select just the subset of tests for the examples they want.
A further advantage of this approach is that it may open up the opportunity for building the examples against an existing Qt installation, similar to how we currently support the standalone test capabilities. This may have some advantages for CI as well.
|For Gerrit Dashboard: QTBUG-90820|
|364769,9||CMake: Run export(EXPORT) for prefixed and top-level builds||dev||qt/qtbase||Status: NEW||+2||0|
|385686,20||CMake: Build examples as ExternalProjects in prefix builds||dev||qt/qtbase||Status: NEW||+2||0|
|386689,6||CMake: Copy FindFoo.cmake scripts to build dir in prefix builds||dev||qt/qtbase||Status: NEW||+2||0|
|386873,7||CMake: Allow installing examples outside of the Qt prefix||dev||qt/qtbase||Status: NEW||+2||0|