summaryrefslogtreecommitdiffstats
path: root/cmake
diff options
context:
space:
mode:
authorAlexandru Croitor <alexandru.croitor@qt.io>2021-10-22 12:20:19 +0200
committerQt Cherry-pick Bot <cherrypick_bot@qt-project.org>2021-10-29 15:22:33 +0000
commitc91e9a0f6dd24eaa52148ecc4c6dca4941e433ee (patch)
treef03694417b470b4227cdef0f59b7aa84b44bea43 /cmake
parentb293dcdc800f793b5f0f13ff8a29ca9c447eb888 (diff)
CMake: Fix _QT_TOOLCHAIN_VARS_INITIALIZED check in toolchain file
The environment variable check to set extra env vars was using invalid syntax. The condition always resolved to TRUE which means the env vars were constantly re-assigned inside each try_compile project. To check for undefined-ness, one can use if(NOT DEFINED ENV{...}) To check for false-ness, one can use if(NOT "$ENV{...}") To check for string emptiness, one can use if(NOT "$ENV{...}" STREQUAL "") In this particular case checking for false-ness is good enough. The extra re-assigning had no visible effect, so this is just cleanup. As a drive-by, clarify one comment. Amends ca59c20939a09587662fa8fecd4e480b68244541 Change-Id: I8fd400101efa9e610a81268c33cac8c0cb33cba3 Reviewed-by: Alexey Edelev <alexey.edelev@qt.io> Reviewed-by: Craig Scott <craig.scott@qt.io> (cherry picked from commit f917df27520874e5645ac51a1f65aae4a2375ce5) Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
Diffstat (limited to 'cmake')
-rw-r--r--cmake/qt.toolchain.cmake.in6
1 files changed, 3 insertions, 3 deletions
diff --git a/cmake/qt.toolchain.cmake.in b/cmake/qt.toolchain.cmake.in
index 79a37fd95a..923ef36575 100644
--- a/cmake/qt.toolchain.cmake.in
+++ b/cmake/qt.toolchain.cmake.in
@@ -142,9 +142,9 @@ if(QT_TOOLCHAIN_INCLUDE_FILE)
endif()
# Compile tests only see a restricted set of variables.
-# All cache variables, this toolchain file uses, must be made available to compile tests,
-# because this toolchain file will be included there too.
-if(NOT ENV{_QT_TOOLCHAIN_VARS_INITIALIZED})
+# All cache variables, this toolchain file uses, must be made available to project-based
+# try_compile tests because this toolchain file will be included there too.
+if(NOT "$ENV{_QT_TOOLCHAIN_VARS_INITIALIZED}")
set(ENV{_QT_TOOLCHAIN_VARS_INITIALIZED} ON)
foreach(var ${__qt_toolchain_used_variables})
set(ENV{_QT_TOOLCHAIN_${var}} "${${var}}")