Android[openssl]: Check existence of OpenSSL .so file before use

VCPKG by default does static builds when building for Android.
This is at odds with the bundling-concept, so it should not be done
unconditionally.

Since we don't necessarily have the WrapOpenSSL target on-hand, let's
just do a file-exists test for the one of the paths we would include.

Pick-to: 6.6 6.5
Change-Id: I3693354308d5168d8a9c3d1659bfa51540114b7f
Reviewed-by: Alexandru Croitor <alexandru.croitor@qt.io>
Reviewed-by: Assam Boudjelthia <assam.boudjelthia@qt.io>
This commit is contained in:
Mårten Nordheim 2023-07-04 12:17:27 +02:00
parent dfddde0b53
commit 20d3827ecc

View File

@ -585,9 +585,14 @@ function(qt_internal_add_test name)
message(WARNING "The argument BUNDLE_ANDROID_OPENSSL_LIBS is set "
"but OPENSSL_ROOT_DIR parameter is not set.")
else()
set_property(TARGET ${name} APPEND PROPERTY QT_ANDROID_EXTRA_LIBS
"${OPENSSL_ROOT_DIR}/${CMAKE_ANDROID_ARCH_ABI}/libcrypto_3.so"
"${OPENSSL_ROOT_DIR}/${CMAKE_ANDROID_ARCH_ABI}/libssl_3.so")
if(EXISTS "${OPENSSL_ROOT_DIR}/${CMAKE_ANDROID_ARCH_ABI}/libcrypto_3.so")
set_property(TARGET ${name} APPEND PROPERTY QT_ANDROID_EXTRA_LIBS
"${OPENSSL_ROOT_DIR}/${CMAKE_ANDROID_ARCH_ABI}/libcrypto_3.so"
"${OPENSSL_ROOT_DIR}/${CMAKE_ANDROID_ARCH_ABI}/libssl_3.so")
else()
message(STATUS "Test should bundle OpenSSL libraries but they are not found."
" This is fine if OpenSSL was built statically.")
endif()
endif()
endif()
qt_internal_android_test_arguments("${name}" test_executable extra_test_args)