summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorAlexandru Croitor <alexandru.croitor@qt.io>2021-10-22 12:20:19 +0200
committerAlexandru Croitor <alexandru.croitor@qt.io>2021-10-29 15:34:12 +0200
commitf917df27520874e5645ac51a1f65aae4a2375ce5 (patch)
treeab7df56377d10f0b43e4a3dbcc6f72fe24b795a3
parent402b8b9ceec9a2010b25c2440c75760fed14fd22 (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 Pick-to: 6.2 Change-Id: I8fd400101efa9e610a81268c33cac8c0cb33cba3 Reviewed-by: Alexey Edelev <alexey.edelev@qt.io> Reviewed-by: Craig Scott <craig.scott@qt.io>
-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 d5fc183c74..5e9acd66b8 100644
--- a/cmake/qt.toolchain.cmake.in
+++ b/cmake/qt.toolchain.cmake.in
@@ -197,9 +197,9 @@ if(__qt_toolchain_host_path_required AND
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}}")