121f7f382b
In Qt 5 times, if Qt was configured with -make examples, running make install would not only build and install the example binaries, but would also install the example sources into the prefix. Installation of example sources was not implemented when the Qt 6 build system has switched to using CMake. There is still a use case for it though, mainly for Qt Creator, which only shows the examples of a Qt kit if the sources are available. In contrast to Qt 5, in Qt 6 we will not install example sources by default. It will be opt in. To enable installation of examples sources, configure with configure -make examples -install-examples-sources or cmake -DQT_BUILD_EXAMPLES=ON -DQT_INSTALL_EXAMPLES_SOURCES=ON The -make examples part is required, otherwise -install-examples-sources has no effect. All example sources can be installed by calling cmake --install . --component examples_sources in the qt repo build directory. In a top-level build, per-repo installation can be done using cmake --install . --component examples_sources_<repo_name> where repo_name could be 'qtbase'. A single example's source can be installed by calling cmake --install . --component examples_sources_<subdir_name> where subdir_name is the subdirectory name of the example, e.g. 'gallery'. Implement installation of example sources by hooking into the qt_internal_add_example command. This means that all examples in all repos need to be added via qt_internal_add_example instead of add_subdirectory, to ensure the sources are installed. The majority of repos already use it. For testing purposes one can configure with -DQT_BUILD_EXAMPLES=ON -DQT_INSTALL_EXAMPLES_SOURCES=ON -DQT_INTERNAL_NO_CONFIGURE_EXAMPLES=ON to allow testing installation of examples sources without building them. Take into account an additional variable called QT_INTERNAL_EXAMPLES_SOURCES_INSTALL_PREFIX to allow installation of example sources into a location different from the example binaries. As a cleanup, the NAME option that could previously be passed to qt_internal_add_example_external_project has been removed. That's because it's never used anywhere and could not have worked anyway because qt_internal_add_example_in_tree never handled it. Pick-to: 6.6 Fixes: QTBUG-112135 Change-Id: I52aa5ec643ff7e212276c88d8dd2dfecdbdbeb0d Reviewed-by: Alexey Edelev <alexey.edelev@qt.io> |
||
---|---|---|
.. | ||
QtStandaloneTestTemplateProject | ||
QtBuildInternalsConfig.cmake |