-
Notifications
You must be signed in to change notification settings - Fork 151
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
add_android_openssl_libraries: Automatically link OpenSSL on argument… #67
base: master
Are you sure you want to change the base?
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,26 +1,30 @@ | ||
function(add_android_openssl_libraries) | ||
if(CMAKE_BUILD_TYPE STREQUAL "Debug") | ||
set(ssl_root_path ${CMAKE_CURRENT_FUNCTION_LIST_DIR}/no-asm) | ||
set(SSL_ROOT_PATH ${CMAKE_CURRENT_FUNCTION_LIST_DIR}/no-asm) | ||
else() | ||
set(ssl_root_path ${CMAKE_CURRENT_FUNCTION_LIST_DIR}) | ||
set(SSL_ROOT_PATH ${CMAKE_CURRENT_FUNCTION_LIST_DIR}) | ||
endif() | ||
|
||
if(Qt6_VERSION VERSION_GREATER_EQUAL 6.5.0) | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. A bit simpler re-write for this could be: find_package(OpenSSL REQUIRED) foreach(TARGET ${ARGN}) There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. actually the set_target_properties() line can be changed to |
||
if(NOT OPENSSL_ROOT_DIR) | ||
set(OPENSSL_ROOT_DIR ${SSL_ROOT_PATH}/ssl_3/${CMAKE_ANDROID_ARCH_ABI}) | ||
endif() | ||
list(APPEND android_extra_libs | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. we no longer need to assign this android_extra_libs list if we're doing it for OPENSSL_SSL_LIBRARY and OPENSSL_INCLUDE_DIR, we can use those latter two variables directly for QT_ANDROID_EXTRA_LIBS |
||
${ssl_root_path}/ssl_3/${CMAKE_ANDROID_ARCH_ABI}/libcrypto_3.so | ||
${ssl_root_path}/ssl_3/${CMAKE_ANDROID_ARCH_ABI}/libssl_3.so) | ||
${SSL_ROOT_PATH}/ssl_3/${CMAKE_ANDROID_ARCH_ABI}/libcrypto_3.so | ||
${SSL_ROOT_PATH}/ssl_3/${CMAKE_ANDROID_ARCH_ABI}/libssl_3.so) | ||
set(OPENSSL_CRYPTO_LIBRARY ${SSL_ROOT_PATH}/ssl_3/${CMAKE_ANDROID_ARCH_ABI}/libcrypto_3.so) | ||
set(OPENSSL_SSL_LIBRARY ${SSL_ROOT_PATH}/ssl_3/${CMAKE_ANDROID_ARCH_ABI}/libssl_3.so) | ||
set(OPENSSL_INCLUDE_DIR ${SSL_ROOT_PATH}/ssl_3/include) | ||
else() | ||
if(NOT OPENSSL_ROOT_DIR) | ||
set(OPENSSL_ROOT_DIR ${SSL_ROOT_PATH}/ssl_1.1/${CMAKE_ANDROID_ARCH_ABI}) | ||
endif() | ||
list(APPEND android_extra_libs | ||
${ssl_root_path}/ssl_1.1/${CMAKE_ANDROID_ARCH_ABI}/libcrypto_1_1.so | ||
${ssl_root_path}/ssl_1.1/${CMAKE_ANDROID_ARCH_ABI}/libssl_1_1.so) | ||
${SSL_ROOT_PATH}/ssl_1.1/${CMAKE_ANDROID_ARCH_ABI}/libcrypto_1_1.so | ||
${SSL_ROOT_PATH}/ssl_1.1/${CMAKE_ANDROID_ARCH_ABI}/libssl_1_1.so) | ||
set(OPENSSL_CRYPTO_LIBRARY ${SSL_ROOT_PATH}/ssl_1.1/${CMAKE_ANDROID_ARCH_ABI}/libcrypto_1_1.so) | ||
set(OPENSSL_SSL_LIBRARY ${SSL_ROOT_PATH}/ssl_1.1/${CMAKE_ANDROID_ARCH_ABI}/libssl_1_1.so) | ||
set(OPENSSL_INCLUDE_DIR ${SSL_ROOT_PATH}/ssl_1.1/include) | ||
endif() | ||
|
||
set_target_properties(${ARGN} PROPERTIES QT_ANDROID_EXTRA_LIBS | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. I think this can also be under the ${ARGN} loop |
||
"${android_extra_libs}") | ||
find_package(OpenSSL REQUIRED) | ||
foreach(TARGET ${ARGN}) | ||
target_link_libraries(${TARGET} PUBLIC OpenSSL::OpenSSL) | ||
endforeach() | ||
endfunction() |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
keep local variable as lowercase