From 0896e203d651af55008aefa6edb7da940c27c02a Mon Sep 17 00:00:00 2001 From: Kevin Funk Date: Tue, 12 Feb 2019 22:39:35 +0100 Subject: [PATCH] cmake: Make sure QT_SYNCQT is persisted Lifetime of the variable is bound to the function body. Use a CACHE variable to escape it (and to speed up future calls to the function). Change-Id: I2d164a1c94e64cc652e65c1eea0522f3d911ad82 Reviewed-by: Simon Hausmann --- cmake/QtBuild.cmake | 16 +++++++++------- 1 file changed, 9 insertions(+), 7 deletions(-) diff --git a/cmake/QtBuild.cmake b/cmake/QtBuild.cmake index 93369ee9659..c63081d8c01 100644 --- a/cmake/QtBuild.cmake +++ b/cmake/QtBuild.cmake @@ -169,14 +169,16 @@ endfunction() function(qt_ensure_sync_qt) qt_ensure_perl() - if(NOT DEFINED QT_SYNCQT) - get_target_property(mocPath "${QT_CMAKE_EXPORT_NAMESPACE}::moc" LOCATION) - get_filename_component(binDirectory "${mocPath}" DIRECTORY) - # We could put this into the cache, but on the other hand there's no real need to - # pollute the app's cache with this. For the first qtbase build, the variable is - # set in global scope. - set(QT_SYNCQT "${binDirectory}/syncqt.pl") + if(DEFINED QT_SYNCQT) + return() endif() + + get_target_property(mocPath "${QT_CMAKE_EXPORT_NAMESPACE}::moc" LOCATION) + get_filename_component(binDirectory "${mocPath}" DIRECTORY) + # We could put this into the cache, but on the other hand there's no real need to + # pollute the app's cache with this. For the first qtbase build, the variable is + # set in global scope. + set(QT_SYNCQT "${binDirectory}/syncqt.pl" CACHE FILEPATH "syncqt script") endfunction() # A version of cmake_parse_arguments that makes sure all arguments are processed and errors out