From eabbb5eb368df3ff606a472bd96a4a4077a214d8 Mon Sep 17 00:00:00 2001 From: Matthias Schiffer Date: Sun, 3 Nov 2013 03:34:00 +0100 Subject: Improve build system for ciphers and MACs as well --- cmake/config.cmake | 6 ------ cmake/deps.cmake | 38 ++++++++++++++++++-------------------- cmake/fastd_module.cmake | 9 +++++---- 3 files changed, 23 insertions(+), 30 deletions(-) (limited to 'cmake') diff --git a/cmake/config.cmake b/cmake/config.cmake index 53f4b65..cc5ca01 100644 --- a/cmake/config.cmake +++ b/cmake/config.cmake @@ -26,12 +26,6 @@ set(WITH_CMDLINE_COMMANDS TRUE CACHE BOOL "Include support for setting handler s set(MAX_CONFIG_DEPTH 10 CACHE STRING "Maximum config include depth") -set(WITH_CIPHER_AES128_CTR TRUE CACHE BOOL "Include the AES128-CTR cipher algorithm") -set(WITH_CIPHER_AES128_CTR_NACL TRUE CACHE BOOL "Include the AES128-CTR implementation from the NaCl library") - -set(WITH_MAC_GHASH TRUE CACHE BOOL "Include the GHASH MAC algorithm") -set(WITH_MAC_GHASH_BUILTIN TRUE CACHE BOOL "Include the built-in GHASH implementation") - # Ensure the value is numeric math(EXPR MAX_CONFIG_DEPTH_NUM ${MAX_CONFIG_DEPTH}) diff --git a/cmake/deps.cmake b/cmake/deps.cmake index e49efcd..fa3cb03 100644 --- a/cmake/deps.cmake +++ b/cmake/deps.cmake @@ -16,26 +16,24 @@ set(NACL_LIBRARY_DIRS "") set(NACL_LIBRARIES "") set(NACL_LDFLAGS_OTHER "") -if(WITH_METHOD_XSALSA20_POLY1305 OR WITH_CIPHER_AES128_CTR_NACL) - if(USE_LIBSODIUM) - pkg_check_modules(SODIUM REQUIRED libsodium) - - set(NACL_INCLUDE_DIRS "${SODIUM_INCLUDE_DIRS}") - foreach(dir "${SODIUM_INCLUDEDIR}" ${SODIUM_INCLUDE_DIRS}) - list(APPEND NACL_INCLUDE_DIRS "${dir}/sodium") - endforeach(dir) - - set(NACL_CFLAGS_OTHER "${SODIUM_CFLAGS_OTHER}") - set(NACL_LIBRARY_DIRS "${SODIUM_LIBRARY_DIRS}") - set(NACL_LIBRARIES "${SODIUM_LIBRARIES}") - set(NACL_LDFLAGS_OTHER "${SODIUM_LDFLAGS_OTHER}") - else(USE_LIBSODIUM) - find_package(NaCl REQUIRED) - - set(NACL_INCLUDE_DIRS "${NACL_INCLUDE_DIR}") - set(NACL_LIBRARIES "${NACL_LIBRARY}") - endif(USE_LIBSODIUM) -endif() +if(USE_LIBSODIUM) + pkg_check_modules(SODIUM REQUIRED libsodium) + + set(NACL_INCLUDE_DIRS "${SODIUM_INCLUDE_DIRS}") + foreach(dir "${SODIUM_INCLUDEDIR}" ${SODIUM_INCLUDE_DIRS}) + list(APPEND NACL_INCLUDE_DIRS "${dir}/sodium") + endforeach(dir) + + set(NACL_CFLAGS_OTHER "${SODIUM_CFLAGS_OTHER}") + set(NACL_LIBRARY_DIRS "${SODIUM_LIBRARY_DIRS}") + set(NACL_LIBRARIES "${SODIUM_LIBRARIES}") + set(NACL_LDFLAGS_OTHER "${SODIUM_LDFLAGS_OTHER}") +else(USE_LIBSODIUM) + find_package(NaCl REQUIRED) + + set(NACL_INCLUDE_DIRS "${NACL_INCLUDE_DIR}") + set(NACL_LIBRARIES "${NACL_LIBRARY}") +endif(USE_LIBSODIUM) if(WITH_CAPABILITIES) diff --git a/cmake/fastd_module.cmake b/cmake/fastd_module.cmake index 1c2da9d..53b6d0f 100644 --- a/cmake/fastd_module.cmake +++ b/cmake/fastd_module.cmake @@ -1,10 +1,11 @@ -function(fastd_module type name) +function(fastd_module type info name) string(TOUPPER "${type}" TYPE) string(REPLACE - _ name_ "${name}") + string(REPLACE " " _ name_ "${name_}") string(TOUPPER "${name_}" NAME) - set(WITH_${TYPE}_${NAME} TRUE CACHE BOOL "Include the ${name} ${type}") + set(WITH_${TYPE}_${NAME} TRUE CACHE BOOL "Include the ${name} ${info}") if(WITH_${TYPE}_${NAME}) add_library(${type}_${name_} STATIC ${ARGN}) @@ -13,8 +14,6 @@ function(fastd_module type name) set_property(TARGET ${type}s APPEND PROPERTY LINK_LIBRARIES ${type}_${name_}) list(APPEND ${TYPE}S ${name_}) - - set_property(GLOBAL APPEND PROPERTY FASTD_${TYPE}S ${name_}) endif(WITH_${TYPE}_${NAME}) endfunction(fastd_module) @@ -22,6 +21,7 @@ function(fastd_module_include_directories type name) string(TOUPPER "${type}" TYPE) string(REPLACE - _ name_ "${name}") + string(REPLACE " " _ name_ "${name_}") string(TOUPPER "${name_}" NAME) if(WITH_${TYPE}_${NAME}) @@ -33,6 +33,7 @@ function(fastd_module_link_libraries type name) string(TOUPPER "${type}" TYPE) string(REPLACE - _ name_ "${name}") + string(REPLACE " " _ name_ "${name_}") string(TOUPPER "${name_}" NAME) if(WITH_${TYPE}_${NAME}) -- cgit v1.2.3