summaryrefslogtreecommitdiffstats
path: root/src/methods/CMakeLists.txt
diff options
context:
space:
mode:
authorMatthias Schiffer <mschiffer@universe-factory.net>2013-10-29 20:28:26 +0100
committerMatthias Schiffer <mschiffer@universe-factory.net>2013-10-29 20:28:26 +0100
commit8df7ea375df1ca8868763e30e90120e13af2b808 (patch)
treef8e5986c16cd7b13a3dbfcdb579122c8bd9847bd /src/methods/CMakeLists.txt
parent96a14063ce55023878fe4d7509b08cc5d9c4b919 (diff)
downloadfastd-8df7ea375df1ca8868763e30e90120e13af2b808.tar
fastd-8df7ea375df1ca8868763e30e90120e13af2b808.zip
Generate method list automagically
Diffstat (limited to 'src/methods/CMakeLists.txt')
-rw-r--r--src/methods/CMakeLists.txt13
1 files changed, 12 insertions, 1 deletions
diff --git a/src/methods/CMakeLists.txt b/src/methods/CMakeLists.txt
index 3ef410b..c5a6273 100644
--- a/src/methods/CMakeLists.txt
+++ b/src/methods/CMakeLists.txt
@@ -12,15 +12,26 @@ if(WITH_METHOD_AES128_GCM)
endif(WITH_METHOD_AES128_GCM)
-set(METHOD_SOURCES "")
+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)