summaryrefslogtreecommitdiffstats
path: root/cmake/QtBuild.cmake
diff options
context:
space:
mode:
authorAlexandru Croitor <alexandru.croitor@qt.io>2020-09-24 18:28:01 +0200
committerAlexandru Croitor <alexandru.croitor@qt.io>2020-11-25 22:08:10 +0100
commit69d9b2b6fdd5cd28aa7dca2636eb2f411277ad30 (patch)
treebd7f81b6371c3b170acbcca9ad463479786c649c /cmake/QtBuild.cmake
parent89b49e52310c5b5e1549e78b334749c4f486cc7f (diff)
CMake: Use cmake_language(DEFER) when available for scope finalizers
If CMake version is 3.19 or greater, use cmake_language(DEFER CALL) for Qt internal scope finalizers, instead of the homegrown implementation. Apart from not depending on the hacky homegrown solution, it significantly improves the readability of --trace-redirect logs. Pick-to: 6.0 Task-number: QTBUG-77377 Change-Id: I5ce374bb313865662c536826e86052bc762438b9 Reviewed-by: Joerg Bornemann <joerg.bornemann@qt.io>
Diffstat (limited to 'cmake/QtBuild.cmake')
-rw-r--r--cmake/QtBuild.cmake7
1 files changed, 5 insertions, 2 deletions
diff --git a/cmake/QtBuild.cmake b/cmake/QtBuild.cmake
index 1252ed2c3c..5af6c0527f 100644
--- a/cmake/QtBuild.cmake
+++ b/cmake/QtBuild.cmake
@@ -494,5 +494,8 @@ if(ANDROID)
include(QtAndroidHelpers)
endif()
-# This sets up the scope finalizer mechanism.
-variable_watch(CMAKE_CURRENT_LIST_DIR qt_watch_current_list_dir)
+# This sets up the poor man's scope finalizer mechanism.
+# For newer CMake versions, we use cmake_language(DEFER CALL) instead.
+if(CMAKE_VERSION VERSION_LESS "3.19.0")
+ variable_watch(CMAKE_CURRENT_LIST_DIR qt_watch_current_list_dir)
+endif()