Skip to content

abdulazizumarovich/android-openssl-cmake

 
 

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

5 Commits
 
 
 
 
 
 

Repository files navigation

OpenSSL For Android

  • Include build-openssl.sh in your app (Preferrably in the app's root folder)
  • Run it once
  • This will make a folder prefix which will have OpenSSL libraries

Using in cmake

Add these to your CMakeLists.txt app :

set(OPENSSL_ROOT_DIR path-to-prefix-folder)
set(OPENSSL_INCLUDE_DIR ${OPENSSL_ROOT_DIR}/include)
set(OPENSSL_CRYPTO_LIBRARY ${OPENSSL_ROOT_DIR}/lib/libcrypto.a)

set(OPENSSL_USE_STATIC_LIBS TRUE)
find_package(OpenSSL REQUIRED)
message("OpenSSL dir: ${OPENSSL_ROOT_DIR}")

if(OPENSSL_FOUND)
    message("OpenSSL ver: ${OPENSSL_VERSION}")
else()
    message("OpenSSL not found")
endif()

target_link_libraries(UnifiedLib OpenSSL::Crypto)

If your CMake file is at app/src/main/cpp/CMakeLists.txt and the prefix folder is in app root then it will be :

set(OPENSSL_ROOT_DIR ${CMAKE_CURRENT_LIST_DIR}/../../../../prefix/${CMAKE_ANDROID_ARCH_ABI})

This is used in Dots app

About

Easy way to use OpenSSL in your cmake Android app

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages

  • Shell 100.0%