aboutsummaryrefslogtreecommitdiffstats
path: root/src/libs/3rdparty/hmac_sha256/CMakeLists.txt
blob: 8a5034048cb6b89c09177c28e1db8b155790adb2 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
cmake_minimum_required(VERSION 3.5)

set(CMAKE_C_STANDARD 99)

# For "CMAKE_INSTALL_<dir>" standard installation directories
include(GNUInstallDirs)

project(hmac_sha256 LANGUAGES C CXX)

option(HMAC_SHA256_TESTS "Build unit tests" FALSE)
option(HMAC_SHA256_EXAMPLES "Build the examples" FALSE)

add_library(hmac_sha256 STATIC
  ${CMAKE_CURRENT_SOURCE_DIR}/sha256.c
  ${CMAKE_CURRENT_SOURCE_DIR}/hmac_sha256.c
)
target_include_directories(hmac_sha256 INTERFACE ${CMAKE_CURRENT_SOURCE_DIR})

install(TARGETS hmac_sha256
  LIBRARY DESTINATION "${CMAKE_INSTALL_LIBDIR}"
  ARCHIVE DESTINATION "${CMAKE_INSTALL_LIBDIR}"
)

install(FILES
  ${CMAKE_CURRENT_SOURCE_DIR}/hmac_sha256.h
  DESTINATION "${CMAKE_INSTALL_INCLUDEDIR}"
)

if (HMAC_SHA256_TESTS)
  enable_testing()
  add_subdirectory(tests)
endif ()

if (HMAC_SHA256_EXAMPLES)
  add_subdirectory(examples)
endif ()