2
0

FindMbedTLS.cmake 1.5 KB

1234567891011121314151617181920212223242526272829303132333435363738
  1. find_path(MBEDTLS_INCLUDE_DIRS mbedtls/ssl.h)
  2. find_library(MBEDTLS_LIBRARY mbedtls)
  3. find_library(MBEDX509_LIBRARY mbedx509)
  4. find_library(MBEDCRYPTO_LIBRARY mbedcrypto)
  5. set(MBEDTLS_LIBRARIES "${MBEDTLS_LIBRARY}" "${MBEDX509_LIBRARY}" "${MBEDCRYPTO_LIBRARY}")
  6. include(FindPackageHandleStandardArgs)
  7. find_package_handle_standard_args(MbedTLS DEFAULT_MSG
  8. MBEDTLS_LIBRARY MBEDTLS_INCLUDE_DIRS MBEDX509_LIBRARY MBEDCRYPTO_LIBRARY)
  9. mark_as_advanced(MBEDTLS_INCLUDE_DIRS MBEDTLS_LIBRARY MBEDX509_LIBRARY MBEDCRYPTO_LIBRARY)
  10. if(NOT TARGET MbedTLS)
  11. message("in mbedtls ${MBEDTLS_LIBRARY}")
  12. add_library(MbedTLS UNKNOWN IMPORTED)
  13. set_target_properties(MbedTLS PROPERTIES
  14. INTERFACE_INCLUDE_DIRECTORIES "${MBEDTLS_INCLUDE_DIRS}"
  15. IMPORTED_LINK_INTERFACE_LANGUAGES "C"
  16. IMPORTED_LOCATION "${MBEDTLS_LIBRARY}")
  17. endif()
  18. if(NOT TARGET MbedCrypto)
  19. add_library(MbedCrypto UNKNOWN IMPORTED)
  20. set_target_properties(MbedCrypto PROPERTIES
  21. INTERFACE_INCLUDE_DIRECTORIES "${MBEDTLS_INCLUDE_DIRS}"
  22. IMPORTED_LINK_INTERFACE_LANGUAGES "C"
  23. IMPORTED_LOCATION "${MBEDCRYPTO_LIBRARY}")
  24. endif()
  25. if(NOT TARGET MbedX509)
  26. add_library(MbedX509 UNKNOWN IMPORTED)
  27. set_target_properties(MbedX509 PROPERTIES
  28. INTERFACE_INCLUDE_DIRECTORIES "${MBEDTLS_INCLUDE_DIRS}"
  29. IMPORTED_LINK_INTERFACE_LANGUAGES "C"
  30. IMPORTED_LOCATION "${MBEDX509_LIBRARY}")
  31. endif()