2019-09-10 21:19:22 +02:00
|
|
|
#
|
|
|
|
# Author: Benjamin Sergeant
|
|
|
|
# Copyright (c) 2019 Machine Zone, Inc. All rights reserved.
|
|
|
|
#
|
2019-09-10 23:05:07 +02:00
|
|
|
set(CMAKE_MODULE_PATH "${CMAKE_CURRENT_SOURCE_DIR}/../CMake;${CMAKE_MODULE_PATH}")
|
2019-09-10 21:19:22 +02:00
|
|
|
|
|
|
|
set (IXCRYPTO_SOURCES
|
|
|
|
ixcrypto/IXHMac.cpp
|
|
|
|
ixcrypto/IXBase64.cpp
|
2019-09-10 23:05:07 +02:00
|
|
|
ixcrypto/IXUuid.cpp
|
2019-09-10 21:19:22 +02:00
|
|
|
ixcrypto/IXHash.cpp
|
|
|
|
)
|
|
|
|
|
|
|
|
set (IXCRYPTO_HEADERS
|
|
|
|
ixcrypto/IXHMac.h
|
|
|
|
ixcrypto/IXBase64.h
|
2019-09-10 23:05:07 +02:00
|
|
|
ixcrypto/IXUuid.h
|
2019-09-10 21:19:22 +02:00
|
|
|
ixcrypto/IXHash.h
|
|
|
|
)
|
|
|
|
|
|
|
|
add_library(ixcrypto STATIC
|
|
|
|
${IXCRYPTO_SOURCES}
|
|
|
|
${IXCRYPTO_HEADERS}
|
|
|
|
)
|
|
|
|
|
2020-03-22 03:31:38 +01:00
|
|
|
set(IXCRYPTO_INCLUDE_DIRS
|
2019-09-10 21:19:22 +02:00
|
|
|
.
|
|
|
|
../ixcore)
|
|
|
|
|
|
|
|
target_include_directories( ixcrypto PUBLIC ${IXCRYPTO_INCLUDE_DIRS} )
|
2019-09-10 23:05:07 +02:00
|
|
|
|
|
|
|
# hmac computation needs a crypto library
|
|
|
|
|
|
|
|
target_compile_definitions(ixcrypto PUBLIC IXCRYPTO_USE_TLS)
|
|
|
|
if (USE_MBED_TLS)
|
|
|
|
find_package(MbedTLS REQUIRED)
|
|
|
|
target_include_directories(ixcrypto PUBLIC ${MBEDTLS_INCLUDE_DIRS})
|
|
|
|
target_link_libraries(ixcrypto ${MBEDTLS_LIBRARIES})
|
|
|
|
target_compile_definitions(ixcrypto PUBLIC IXCRYPTO_USE_MBED_TLS)
|
2020-05-27 00:15:45 +02:00
|
|
|
elseif (USE_OPEN_SSL)
|
2019-09-10 23:05:07 +02:00
|
|
|
find_package(OpenSSL REQUIRED)
|
|
|
|
add_definitions(${OPENSSL_DEFINITIONS})
|
|
|
|
message(STATUS "OpenSSL: " ${OPENSSL_VERSION})
|
|
|
|
include_directories(${OPENSSL_INCLUDE_DIR})
|
|
|
|
target_link_libraries(ixcrypto ${OPENSSL_LIBRARIES})
|
|
|
|
target_compile_definitions(ixcrypto PUBLIC IXCRYPTO_USE_OPEN_SSL)
|
|
|
|
endif()
|