diff options
author | Alexandru Croitor <alexandru.croitor@qt.io> | 2019-05-08 14:45:41 +0200 |
---|---|---|
committer | Alexandru Croitor <alexandru.croitor@qt.io> | 2019-05-15 11:31:31 +0000 |
commit | 02a015375a639a4d27d19bbf435f20b725696768 (patch) | |
tree | 6efe36f0290cbe7d5eb4c44f847974c1bd44f645 /cmake/QtFeature.cmake | |
parent | 6396d46f554e6eab2ba7f212bd7447961cd4c286 (diff) |
Implement developer / non-prefix builds
A non-prefix build is a build where you don't have to run
make install.
To do a non-prefix build, pass -DFEATURE_developer_build=ON when
invoking CMake on qtbase. Note that this of course also enables
developer build features (private tests, etc).
When doing a non-prefix build, the CMAKE_INSTALL_PREFIX cache variable
will point to the qtbase build directory.
Tests can be run without installing Qt (QPA plugins are picked up from
the build dir).
This patch stops installation of any files by forcing the
make "install" target be a no-op.
When invoking cmake on the qtsvg module (or any other module),
the CMAKE_INSTALL_PREFIX variable should be set to the qtbase build
directory.
The developer-build feature is propagated via the QtCore Config file,
so that when building other modules, you don't have to specify it
on the command line again.
As a result of the change, all libraries, plugins, tools, include dirs,
CMake Config files, CMake Targets files, Macro files, etc,
will be placed in the qtbase build directory, mimicking the file layout
of an installed Qt file layout.
Only examples and tests are kept in the separate module build
directories, which is equivalent to how qmake does it.
The following global variables contain paths for the
appropriate prefix or non prefix builds:
QT_BUILD_DIR, QT_INSTALL_DIR, QT_CONFIG_BUILD_DIR,
QT_CONFIG_INSTALL_DIR. These should be used by developers
when deciding where files should be placed.
All usages of install() are replaced by qt_install(), which has some
additional logic on how to handle associationg of CMake targets to
export names.
When installing files, some consideration should be taken if
qt_copy_or_install() needs to be used instead of qt_install(),
which takes care of copying files from the source dir to the build dir
when doing non-prefix builds.
Tested with qtbase and qtsvg, developer builds, non-developer builds
and static developer builds on Windows, Linux and macOS.
Task-number: QTBUG-75581
Change-Id: I0ed27fb6467662dd24fb23aee6b95dd2c9c4061f
Reviewed-by: Kevin Funk <kevin.funk@kdab.com>
Reviewed-by: Tobias Hunger <tobias.hunger@qt.io>
Diffstat (limited to 'cmake/QtFeature.cmake')
-rw-r--r-- | cmake/QtFeature.cmake | 28 |
1 files changed, 25 insertions, 3 deletions
diff --git a/cmake/QtFeature.cmake b/cmake/QtFeature.cmake index 2166ac69ff..50c672d08c 100644 --- a/cmake/QtFeature.cmake +++ b/cmake/QtFeature.cmake @@ -337,7 +337,19 @@ function(qt_internal_feature_write_file file features extra) file(GENERATE OUTPUT "${file}" CONTENT "${contents}") endfunction() -function(qt_feature_module_end target) +function(qt_feature_module_end) + set(flags) + set(options OUT_VAR_PREFIX) + set(multiopts) + cmake_parse_arguments(arg "${flags}" "${options}" "${multiopts}" ${ARGN}) + set(target ${arg_UNPARSED_ARGUMENTS}) + + # The value of OUT_VAR_PREFIX is used as a prefix for output variables that should be + # set in the parent scope. + if(NOT arg_OUT_VAR_PREFIX) + set(arg_OUT_VAR_PREFIX "") + endif() + set(all_features ${__QtFeature_public_features} ${__QtFeature_private_features} ${__QtFeature_internal_features}) list(REMOVE_DUPLICATES all_features) @@ -378,12 +390,22 @@ function(qt_feature_module_end target) qt_internal_feature_write_file("${CMAKE_CURRENT_BINARY_DIR}/${__QtFeature_private_file}" "${__QtFeature_private_features}" "${__QtFeature_private_extra}" ) - qt_generate_forwarding_headers("${__QtFeature_library}" SOURCE "${__QtFeature_private_file}" PRIVATE) qt_internal_feature_write_file("${CMAKE_CURRENT_BINARY_DIR}/${__QtFeature_public_file}" "${__QtFeature_public_features}" "${__QtFeature_public_extra}" ) - qt_generate_forwarding_headers("${__QtFeature_library}" SOURCE "${__QtFeature_public_file}") + + # Extra header injections which have to have forwarding headers created by + # qt_install_injections. + set(injections "") + qt_compute_injection_forwarding_header("${__QtFeature_library}" + SOURCE "${__QtFeature_public_file}" + OUT_VAR injections) + qt_compute_injection_forwarding_header("${__QtFeature_library}" + SOURCE "${__QtFeature_private_file}" PRIVATE + OUT_VAR injections) + + set(${arg_OUT_VAR_PREFIX}extra_library_injections ${injections} PARENT_SCOPE) if (NOT ("${target}" STREQUAL "NO_MODULE")) get_target_property(targetType "${target}" TYPE) |