2024-12-20 02:03:16 +00:00
|
|
|
cmake_minimum_required(VERSION 3.10)
|
|
|
|
|
|
|
|
project(md5 VERSION 0.0.1 LANGUAGES CXX)
|
|
|
|
|
|
|
|
set(CMAKE_CXX_STANDARD 20)
|
|
|
|
set(CMAKE_CXX_STANDARD_REQUIRED ON)
|
|
|
|
|
2024-12-20 21:02:40 +00:00
|
|
|
set(SOURCES)
|
|
|
|
if (USE_WIN_CRYPTO)
|
|
|
|
list(APPEND SOURCES md5_win32.cpp)
|
|
|
|
else ()
|
|
|
|
# Derived from the "RSA Data Security, Inc. MD5 Message-Digest Algorithm":
|
|
|
|
# https://github.com/freebsd/freebsd-src/blob/release/14.2.0/sys/kern/md5c.c
|
|
|
|
list(APPEND SOURCES md5.cpp)
|
|
|
|
endif ()
|
|
|
|
|
|
|
|
add_library(libmd5 STATIC ${SOURCES})
|
2024-12-20 02:03:16 +00:00
|
|
|
target_include_directories(libmd5
|
|
|
|
PUBLIC
|
|
|
|
"$<BUILD_INTERFACE:${CMAKE_CURRENT_SOURCE_DIR}>"
|
|
|
|
"$<INSTALL_INTERFACE:${CMAKE_INSTALL_INCLUDEDIR}>"
|
|
|
|
)
|
2024-12-20 21:02:40 +00:00
|
|
|
|
|
|
|
if (USE_WIN_CRYPTO)
|
|
|
|
target_link_libraries(libmd5 PRIVATE crypt32)
|
|
|
|
target_compile_definitions(libmd5 PRIVATE USE_WIN_CRYPTO=1)
|
|
|
|
endif ()
|