summaryrefslogtreecommitdiffstats
path: root/src/methods/CMakeLists.txt
blob: c5a62734a332626cb7de72abf4b3c1d1fe7b5bf0 (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
37
set(METHODS null)
set(METHOD_COMMON FALSE)

if(WITH_METHOD_XSALSA20_POLY1305)
  list(APPEND METHODS xsalsa20_poly1305)
  set(METHOD_COMMON TRUE)
endif(WITH_METHOD_XSALSA20_POLY1305)

if(WITH_METHOD_AES128_GCM)
  list(APPEND METHODS aes128_gcm)
  set(METHOD_COMMON TRUE)
endif(WITH_METHOD_AES128_GCM)


set(METHOD_SOURCES "${CMAKE_CURRENT_BINARY_DIR}/methods.c")

set(METHOD_DEFINITIONS "")
set(METHOD_LIST "")

foreach(method ${METHODS})
  add_subdirectory(${method})

  list(APPEND METHOD_SOURCES $<TARGET_OBJECTS:method_${method}>)

  set(METHOD_DEFINITIONS "${METHOD_DEFINITIONS}\nextern const fastd_method_t fastd_method_${method};")
  set(METHOD_LIST "${METHOD_LIST}\n&fastd_method_${method},")
endforeach(method)

if(METHOD_COMMON)
  list(APPEND METHOD_SOURCES ${CMAKE_CURRENT_SOURCE_DIR}/common.c)
endif(METHOD_COMMON)


configure_file(${CMAKE_CURRENT_SOURCE_DIR}/methods.c.in ${CMAKE_CURRENT_BINARY_DIR}/methods.c)


set(METHOD_SOURCES "${METHOD_SOURCES}" PARENT_SCOPE)