OpenSSL.cmake 1.1 KB

1234567891011121314151617181920212223242526272829303132333435
  1. include(ProcessorCount)
  2. ProcessorCount(NPROC)
  3. set(_conf_cmd "./config")
  4. set(_cross_arch "")
  5. set(_cross_comp_prefix_line "")
  6. if (CMAKE_CROSSCOMPILING)
  7. set(_conf_cmd "./Configure")
  8. set(_cross_comp_prefix_line "--cross-compile-prefix=${TOOLCHAIN_PREFIX}-")
  9. if (${CMAKE_SYSTEM_PROCESSOR} STREQUAL "aarch64" OR ${CMAKE_SYSTEM_PROCESSOR} STREQUAL "arm64")
  10. set(_cross_arch "linux-aarch64")
  11. elseif (${CMAKE_SYSTEM_PROCESSOR} STREQUAL "armhf") # For raspbian
  12. # TODO: verify
  13. set(_cross_arch "linux-armv4")
  14. endif ()
  15. endif ()
  16. ExternalProject_Add(dep_OpenSSL
  17. EXCLUDE_FROM_ALL ON
  18. URL "https://github.com/openssl/openssl/archive/OpenSSL_1_1_0l.tar.gz"
  19. URL_HASH SHA256=e2acf0cf58d9bff2b42f2dc0aee79340c8ffe2c5e45d3ca4533dd5d4f5775b1d
  20. DOWNLOAD_DIR ${DEP_DOWNLOAD_DIR}/OpenSSL
  21. BUILD_IN_SOURCE ON
  22. CONFIGURE_COMMAND ${_conf_cmd} ${_cross_arch}
  23. "--prefix=${DESTDIR}/usr/local"
  24. ${_cross_comp_prefix_line}
  25. no-shared
  26. no-ssl3-method
  27. no-dynamic-engine
  28. -Wa,--noexecstack
  29. BUILD_COMMAND make depend && make "-j${NPROC}"
  30. INSTALL_COMMAND make install_sw
  31. )