2023-08-01 13:54:17 +08:00
|
|
|
find_package(Boost REQUIRED COMPONENTS serialization)
|
|
|
|
|
|
|
|
add_library(Encrypt
|
|
|
|
Encrypt.h Encrypt.cpp
|
|
|
|
MessageDigest.h MessageDigest.cpp
|
|
|
|
SecureHashAlgorithm.h SecureHashAlgorithm.cpp
|
|
|
|
)
|
|
|
|
|
|
|
|
target_include_directories(Encrypt
|
|
|
|
INTERFACE ${CMAKE_CURRENT_SOURCE_DIR}
|
|
|
|
PRIVATE ${Boost_INCLUDE_DIRS}
|
|
|
|
)
|
|
|
|
|
|
|
|
set(MBEDTLS_VERSION 3.4.0)
|
|
|
|
|
|
|
|
add_library(mbedtls-${MBEDTLS_VERSION}
|
|
|
|
mbedtls-${MBEDTLS_VERSION}/library/md.c
|
|
|
|
mbedtls-${MBEDTLS_VERSION}/library/md5.c
|
|
|
|
mbedtls-${MBEDTLS_VERSION}/library/sha1.c
|
|
|
|
mbedtls-${MBEDTLS_VERSION}/library/sha256.c
|
|
|
|
mbedtls-${MBEDTLS_VERSION}/library/sha512.c
|
|
|
|
mbedtls-${MBEDTLS_VERSION}/library/ripemd160.c
|
|
|
|
mbedtls-${MBEDTLS_VERSION}/library/platform_util.c
|
|
|
|
)
|
|
|
|
|
|
|
|
target_include_directories(mbedtls-${MBEDTLS_VERSION}
|
|
|
|
PUBLIC ${CMAKE_CURRENT_SOURCE_DIR}/mbedtls-${MBEDTLS_VERSION}/include
|
|
|
|
)
|
|
|
|
|
|
|
|
target_link_libraries(Encrypt
|
2024-05-28 21:18:38 +08:00
|
|
|
PUBLIC mbedtls-${MBEDTLS_VERSION}
|
2023-08-01 13:54:17 +08:00
|
|
|
)
|
|
|
|
|
|
|
|
if(UNIX)
|
|
|
|
target_compile_options(Encrypt
|
|
|
|
PRIVATE -fPIC
|
|
|
|
)
|
|
|
|
endif()
|