CMake: Fix setting Android SDK/NDK from environment variables

The checks for the environment variables ANDROID_SDK_ROOT and
ANDROID_NDK_ROOT were guarded by if(DEFINED) conditions. However, these
variables are *always* defined by the code that iterates over
__qt_toolchain_used_variables earlier in the toolchain file.

Change the existence checks into emptiness checks.

Pick-to: 6.5
Change-Id: I6c87f86068817e45dd2325359827c6fa4dae6279
Reviewed-by: Alexandru Croitor <alexandru.croitor@qt.io>
Reviewed-by: Amir Masoud Abdol <amir.abdol@qt.io>
This commit is contained in:
Joerg Bornemann 2023-03-29 14:20:37 +02:00
parent db9fa4a617
commit 26f0657fee

View File

@ -222,15 +222,11 @@ set(__qt_chainload_toolchain_file \"\${__qt_initially_configured_toolchain_file}
elseif(ANDROID)
list(APPEND init_platform
"# Detect Android SDK/NDK from environment before loading the Android platform toolchain file."
"if(NOT DEFINED ANDROID_SDK_ROOT)"
" if(NOT \"\$ENV{ANDROID_SDK_ROOT}\" STREQUAL \"\")"
" set(ANDROID_SDK_ROOT \"\$ENV{ANDROID_SDK_ROOT}\" CACHE STRING \"Path to the Android SDK\")"
" endif()"
"if(\"$\{ANDROID_SDK_ROOT}\" STREQUAL \"\" AND NOT \"\$ENV{ANDROID_SDK_ROOT}\" STREQUAL \"\")"
" set(ANDROID_SDK_ROOT \"\$ENV{ANDROID_SDK_ROOT}\" CACHE STRING \"Path to the Android SDK\")"
"endif()"
"if(NOT DEFINED ANDROID_NDK_ROOT)"
" if(NOT \"\$ENV{ANDROID_NDK_ROOT}\" STREQUAL \"\")"
" set(ANDROID_NDK_ROOT \"\$ENV{ANDROID_NDK_ROOT}\" CACHE STRING \"Path to the Android NDK\")"
" endif()"
"if(\"$\{ANDROID_NDK_ROOT}\" STREQUAL \"\" AND NOT \"\$ENV{ANDROID_NDK_ROOT}\" STREQUAL \"\")"
" set(ANDROID_NDK_ROOT \"\$ENV{ANDROID_NDK_ROOT}\" CACHE STRING \"Path to the Android NDK\")"
"endif()"
)