cmake equivalent for qmake's ANDROID_EXTRA_LIBS
-
Hello everyone,
I'm porting a project from Qt 5.15 to Qt 6.8.1 but I'm running into some problems.
In my app.pro file I have this line of code:ANDROID_EXTRA_LIBS += $$PWD/ssl/android/arm64-v8a/libcrypto.so $$PWD/ssl/android/arm64-v8a/libssl.so
I need to port this in cmake and I found this: https://doc.qt.io/qt-6/android-openssl-support.html
At some point it says:Alternatively, to add extra libraries, such as libcrypto and libssl. For CMake, use:
set_target_properties(<target_name> PROPERTIES
QT_ANDROID_EXTRA_LIBS "<path_to_libs_dir>/libcrypto_3.so" "<path_to_libs_dir>/libssl_3.so"
)Or for qmake use:
ANDROID_EXTRA_LIBS +=
<path_to_libs_dir>/libcrypto_3.so
<path_to_libs_dir>/libssl_3.soThat's exactly what I need but when I put this line in my CMakeLists.txt
set_target_properties(SamsungRC PROPERTIES QT_ANDROID_EXTRA_LIBS "ssl/android/arm64-v8a/libcrypto.so" "ssl/android/arm64-v8a/libssl.so" )
I get this error:
CMakeLists.txt:72: error: set_target_properties called with incorrect number of arguments.
Is the documentation wrong or am I missing something?
Thank you in advance -
I've found the solution! (Qt doc is wrong)
set_target_properties(SamsungRC PROPERTIES QT_ANDROID_EXTRA_LIBS "${CMAKE_CURRENT_SOURCE_DIR}/ssl/android/${ANDROID_ABI}/libcrypto_3.so;${CMAKE_CURRENT_SOURCE_DIR}/ssl/android/${ANDROID_ABI}/libssl_3.so" )
The values in QT_ANDROID_EXTRA_LIBS need to be separated by a semicolon.
-
Maybe this will work
target_link_libraries(SamsungRC PRIVATE ssl/android/arm64-v8a/libcrypto PRIVATE ssl/android/arm64-v8a/libssl }
I use this myself to add openssl to my app:
if (ANDROID) FetchContent_Declare( android_openssl DOWNLOAD_EXTRACT_TIMESTAMP true URL https://github.com/KDAB/android_openssl/archive/refs/heads/master.zip # URL_HASH MD5=c97d6ad774fab16be63b0ab40f78d945 #optional ) FetchContent_MakeAvailable(android_openssl) include(${android_openssl_SOURCE_DIR}/android_openssl.cmake) endif() if (ANDROID) add_android_openssl_libraries(appskywalker) endif()
-
I've found the solution! (Qt doc is wrong)
set_target_properties(SamsungRC PROPERTIES QT_ANDROID_EXTRA_LIBS "${CMAKE_CURRENT_SOURCE_DIR}/ssl/android/${ANDROID_ABI}/libcrypto_3.so;${CMAKE_CURRENT_SOURCE_DIR}/ssl/android/${ANDROID_ABI}/libssl_3.so" )
The values in QT_ANDROID_EXTRA_LIBS need to be separated by a semicolon.
-