97 lines
2.2 KiB
CMake
97 lines
2.2 KiB
CMake
|
###############################################################################
|
||
|
cmake_minimum_required(VERSION 3.7.0)
|
||
|
project(cruft-crypto CXX)
|
||
|
|
||
|
|
||
|
###############################################################################
|
||
|
if (NOT TARGET cruft-util)
|
||
|
message (FATAL_ERROR "cruft-util was not found")
|
||
|
endif ()
|
||
|
|
||
|
|
||
|
###############################################################################
|
||
|
list (APPEND sources
|
||
|
fwd.hpp
|
||
|
|
||
|
hash/md2.cpp
|
||
|
hash/md2.hpp
|
||
|
hash/md4.cpp
|
||
|
hash/md4.hpp
|
||
|
hash/md5.cpp
|
||
|
hash/md5.hpp
|
||
|
hash/ripemd.cpp
|
||
|
hash/ripemd.hpp
|
||
|
hash/sha1.cpp
|
||
|
hash/sha1.hpp
|
||
|
hash/sha2.cpp
|
||
|
hash/sha2.hpp
|
||
|
|
||
|
hash/hmac.cpp
|
||
|
hash/hmac.hpp
|
||
|
|
||
|
hash/hotp.cpp
|
||
|
hash/hotp.hpp
|
||
|
|
||
|
stream/rc4.cpp
|
||
|
stream/rc4.hpp
|
||
|
stream/salsa.cpp
|
||
|
stream/salsa.hpp
|
||
|
|
||
|
block/tea.cpp
|
||
|
block/tea.hpp
|
||
|
block/xtea.cpp
|
||
|
block/xtea.hpp
|
||
|
block/xxtea.cpp
|
||
|
block/xxtea.hpp
|
||
|
)
|
||
|
|
||
|
|
||
|
option (TESTS "enable unit testing" ON)
|
||
|
|
||
|
if (TESTS)
|
||
|
include (CTest)
|
||
|
enable_testing ()
|
||
|
|
||
|
list (APPEND tests
|
||
|
hash/md2
|
||
|
hash/md4
|
||
|
hash/md5
|
||
|
hash/ripemd
|
||
|
hash/sha1
|
||
|
hash/sha2
|
||
|
|
||
|
hash/hmac
|
||
|
hash/hotp
|
||
|
|
||
|
stream/rc4
|
||
|
stream/salsa
|
||
|
|
||
|
block/tea
|
||
|
block/xtea
|
||
|
block/xxtea
|
||
|
)
|
||
|
|
||
|
foreach (t ${tests})
|
||
|
string(REPLACE "/" "_" name "test/${t}")
|
||
|
add_executable(crypto_test_${name} test/${t}.cpp)
|
||
|
target_link_libraries(crypto_test_${name} PRIVATE cruft-crypto)
|
||
|
target_include_directories(crypto_test_${name} PRIVATE ${CMAKE_CURRENT_SOURCE_DIR})
|
||
|
add_test(NAME crypto_test_${name} COMMAND crypto_test_${name})
|
||
|
endforeach()
|
||
|
endif ()
|
||
|
|
||
|
|
||
|
###############################################################################
|
||
|
add_library (cruft-crypto STATIC ${sources})
|
||
|
target_link_libraries (cruft-crypto INTERFACE cruft-util)
|
||
|
|
||
|
|
||
|
##-----------------------------------------------------------------------------
|
||
|
add_executable (crypto_hash tools/hash.cpp)
|
||
|
target_link_libraries (crypto_hash cruft-crypto)
|
||
|
|
||
|
|
||
|
###############################################################################
|
||
|
configure_file(libcruft-crypto.pc.in libcruft-crypto.pc)
|
||
|
configure_file(Doxyfile.in Doxyfile)
|