From 7fe38b0200979c15cc27a84ab51b2730e7f2d30e Mon Sep 17 00:00:00 2001 From: Matthias Schiffer Date: Sun, 3 Nov 2013 10:32:00 +0100 Subject: Fix disabling modules --- cmake/fastd_module.cmake | 5 ++++- src/crypto/cipher/CMakeLists.txt | 6 ++++-- src/crypto/mac/CMakeLists.txt | 6 ++++-- src/methods/CMakeLists.txt | 9 ++++++--- 4 files changed, 18 insertions(+), 8 deletions(-) diff --git a/cmake/fastd_module.cmake b/cmake/fastd_module.cmake index 53b6d0f..d18719a 100644 --- a/cmake/fastd_module.cmake +++ b/cmake/fastd_module.cmake @@ -1,4 +1,4 @@ -function(fastd_module type info name) +function(fastd_module type enabled_var info name) string(TOUPPER "${type}" TYPE) string(REPLACE - _ name_ "${name}") @@ -14,7 +14,10 @@ function(fastd_module type info name) set_property(TARGET ${type}s APPEND PROPERTY LINK_LIBRARIES ${type}_${name_}) list(APPEND ${TYPE}S ${name_}) + endif(WITH_${TYPE}_${NAME}) + + set(${enabled_var} ${WITH_${TYPE}_${NAME}} PARENT_SCOPE) endfunction(fastd_module) function(fastd_module_include_directories type name) diff --git a/src/crypto/cipher/CMakeLists.txt b/src/crypto/cipher/CMakeLists.txt index 6cf6d64..3d70c70 100644 --- a/src/crypto/cipher/CMakeLists.txt +++ b/src/crypto/cipher/CMakeLists.txt @@ -16,9 +16,11 @@ macro(fastd_cipher_impl cipher name) string(REPLACE - _ cipher_ "${cipher}") string(TOUPPER "${cipher_}" CIPHER) - set_property(GLOBAL APPEND PROPERTY FASTD_CIPHER_${CIPHER}_IMPLS ${name}) + fastd_module(cipher enabled "cipher implementation" "${cipher} ${name}" ${ARGN}) - fastd_module(cipher "cipher implementation" "${cipher} ${name}" ${ARGN}) + if(${enabled}) + set_property(GLOBAL APPEND PROPERTY FASTD_CIPHER_${CIPHER}_IMPLS ${name}) + endif(${enabled}) endmacro(fastd_cipher_impl) macro(fastd_cipher_impl_include_directories cipher name) diff --git a/src/crypto/mac/CMakeLists.txt b/src/crypto/mac/CMakeLists.txt index eb3c903..8c80ee1 100644 --- a/src/crypto/mac/CMakeLists.txt +++ b/src/crypto/mac/CMakeLists.txt @@ -16,9 +16,11 @@ macro(fastd_mac_impl mac name) string(REPLACE - _ mac_ "${mac}") string(TOUPPER "${mac_}" MAC) - set_property(GLOBAL APPEND PROPERTY FASTD_MAC_${MAC}_IMPLS ${name}) + fastd_module(mac enabled "MAC implementation" "${mac} ${name}" ${ARGN}) - fastd_module(mac "MAC implementation" "${mac} ${name}" ${ARGN}) + if(${enabled}) + set_property(GLOBAL APPEND PROPERTY FASTD_MAC_${MAC}_IMPLS ${name}) + endif(${enabled}) endmacro(fastd_mac_impl) macro(fastd_mac_impl_include_directories mac name) diff --git a/src/methods/CMakeLists.txt b/src/methods/CMakeLists.txt index 0060f7c..f67ea0c 100644 --- a/src/methods/CMakeLists.txt +++ b/src/methods/CMakeLists.txt @@ -1,9 +1,12 @@ add_library(methods STATIC "${CMAKE_CURRENT_BINARY_DIR}/methods.c") -add_library(method_common STATIC "common.c") +add_library(method_common STATIC EXCLUDE_FROM_ALL "common.c") macro(fastd_method name) - fastd_module(method "method" ${name} ${ARGN}) - set_property(GLOBAL APPEND PROPERTY FASTD_METHODS ${name}) + fastd_module(method enabled "method" ${name} ${ARGN}) + + if(${enabled}) + set_property(GLOBAL APPEND PROPERTY FASTD_METHODS ${name}) + endif(${enabled}) endmacro(fastd_method) macro(fastd_method_include_directories) -- cgit v1.2.3