############################################################################### 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/blake.cpp hash/blake.hpp hash/blake2.cpp hash/blake2.hpp hash/md2.cpp hash/md2.hpp hash/md4.cpp hash/md4.hpp hash/md5.cpp hash/md5.hpp hash/md6.cpp hash/md6.hpp hash/ripemd.cpp hash/ripemd.hpp hash/sha1.cpp hash/sha1.hpp hash/sha2.cpp hash/sha2.hpp hash/pbkdf2.cpp hash/pbkdf2.hpp hash/hmac.cpp hash/hmac.hpp hash/hotp.cpp hash/hotp.hpp stream/chacha.cpp stream/chacha.hpp stream/rabbit.cpp stream/rabbit.hpp stream/rc4.cpp stream/rc4.hpp stream/rc5.cpp stream/rc5.hpp stream/rc6.cpp stream/rc6.hpp stream/salsa.cpp stream/salsa.hpp block/blowfish.cpp block/blowfish.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/blake hash/blake2 hash/md2 hash/md4 hash/md5 hash/md6 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_${name} test/${t}.cpp) target_link_libraries(crypto_${name} PRIVATE cruft-crypto) target_include_directories(crypto_${name} PRIVATE ${CMAKE_CURRENT_SOURCE_DIR}) add_test(NAME crypto_${name} COMMAND crypto_${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)