summaryrefslogtreecommitdiffstats
path: root/cmake
diff options
context:
space:
mode:
authorLeander Beernaert <leander.beernaert@qt.io>2020-04-23 08:01:47 +0200
committerLeander Beernaert <leander.beernaert@qt.io>2020-04-24 07:41:11 +0200
commitdd7e40b1086020f6a054957f4972720cd6849280 (patch)
tree7b3ba910f30928b5030d6b2489d464730a1cf89e /cmake
parent35848f2a32d914bc1302bdbceaa949770fc4aea4 (diff)
CMake: qt_find_package() enable debug behavior by default
Without this behavior enabled by default it is currently not possible to build QtVirtualKeyboard as a static build. We run into the error where cmake is trying to promote the targets to be global due the XCB library already being found by one of the modules in QtBase. In case we wish to disable this fix, any module can simply specify QT_FIND_PACKAGE_DISABLE_DEBUG_BEHAVIOR=ON during configuration time. Change-Id: Id7f2ad12ddea941dda754361660c7606439cd5a4 Reviewed-by: Alexandru Croitor <alexandru.croitor@qt.io>
Diffstat (limited to 'cmake')
-rw-r--r--cmake/QtBuild.cmake9
1 files changed, 7 insertions, 2 deletions
diff --git a/cmake/QtBuild.cmake b/cmake/QtBuild.cmake
index b3eafd8d9e..1937e1a2ff 100644
--- a/cmake/QtBuild.cmake
+++ b/cmake/QtBuild.cmake
@@ -4246,9 +4246,14 @@ macro(qt_find_package)
# targets to be global. This behavior is not enabled by default, because there are cases
# when a regular find_package() (non qt_) can find a package (Freetype -> PNG), and a subsequent
# qt_find_package(PNG PROVIDED_TARGET PNG::PNG) still needs to succeed and register the provided
- # targets. To enable the debugging behavior, set QT_DEBUG_QT_FIND_PACKAGE to 1.
+ # targets.
+ # Recently we have observed that some projects, such as QtVirtualKeyboard, will error out in
+ # static build because of the global promotion error. The previous code only enabled the if
+ # statement below when QT_DEBUG_QT_FIND_PACKAGE was set to true. Now we have this check enabled
+ # by default unless QT_FIND_PACKAGE_DISABLE_DEBUG_BEHAVIOR is defined and set to true.
set(_qt_find_package_skip_find_package FALSE)
- if(QT_DEBUG_QT_FIND_PACKAGE AND ${ARGV0}_FOUND AND arg_PROVIDED_TARGETS)
+ if((NOT DEFINED QT_FIND_PACKAGE_DISABLE_DEBUG_BEHAVIOR OR NOT QT_FIND_PACKAGE_DISABLE_DEBUG_BEHAVIOR)
+ AND ${ARGV0}_FOUND AND arg_PROVIDED_TARGETS)
set(_qt_find_package_skip_find_package TRUE)
foreach(qt_find_package_target_name ${arg_PROVIDED_TARGETS})
if(NOT TARGET ${qt_find_package_target_name})