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.

Change-Id: I3693354308d5168d8a9c3d1659bfa51540114b7f
Reviewed-by: Alexandru Croitor <alexandru.croitor@qt.io>
Reviewed-by: Assam Boudjelthia <assam.boudjelthia@qt.io>
(cherry picked from commit 20d3827ecca29f46ce147d519274942e5ca33263)
Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
This commit is contained in:
Mårten Nordheim 2023-07-04 12:17:27 +02:00 committed by Qt Cherry-pick Bot
parent 05a2a4b450
commit 6334d43fce

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)