kgg-dec/third-party/md5/CMakeLists.txt

28 lines
776 B
CMake
Raw Normal View History

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)
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})
target_include_directories(libmd5
PUBLIC
"$<BUILD_INTERFACE:${CMAKE_CURRENT_SOURCE_DIR}>"
"$<INSTALL_INTERFACE:${CMAKE_INSTALL_INCLUDEDIR}>"
)
if (USE_WIN_CRYPTO)
target_link_libraries(libmd5 PRIVATE crypt32)
target_compile_definitions(libmd5 PRIVATE USE_WIN_CRYPTO=1)
endif ()