From 42baae32bc212e9287e11afa685e2de77cdf48e4 Mon Sep 17 00:00:00 2001 From: Vsevolod Stakhov Date: Mon, 5 Apr 2010 21:09:40 +0400 Subject: * Add initial version of lua configuration system --- CMakeLists.txt | 51 +++++++++++++++++++-------------------------------- 1 file changed, 19 insertions(+), 32 deletions(-) (limited to 'CMakeLists.txt') diff --git a/CMakeLists.txt b/CMakeLists.txt index e7e713e1c..480fe88ce 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -19,7 +19,6 @@ CMAKE_MINIMUM_REQUIRED(VERSION 2.6.0 FATAL_ERROR) OPTION(DEBUG_MODE "Enable debug output [default: ON]" ON) OPTION(ENABLE_OPTIMIZATION "Enable optimization [default: OFF]" OFF) OPTION(ENABLE_PERL "Enable perl support [default: OFF]" OFF) -OPTION(ENABLE_LUA "Enable lua support [default: ON]" ON) OPTION(SKIP_RELINK_RPATH "Skip relinking and full RPATH for the install tree" OFF) OPTION(ENABLE_REDIRECTOR "Enable redirector install [default: OFF]" OFF) OPTION(ENABLE_PROFILING "Enable profiling [default: OFF]" OFF) @@ -65,26 +64,20 @@ ELSE(ENABLE_PERL MATCHES "ON") SET(WITHOUT_PERL 1) ENDIF(ENABLE_PERL MATCHES "ON") -IF(ENABLE_LUA MATCHES "ON") - IF (ENABLE_PERL MATCHES "ON") - MESSAGE(FATAL_ERROR "Error: Perl and Lua support cannot be turned on together") - ENDIF (ENABLE_PERL MATCHES "ON") - - INCLUDE(FindLua51) - IF(NOT LUA_FOUND) - # Automatic check failed, check passed variable - IF(LUA_INCLUDE_DIR) - INCLUDE_DIRECTORIES("${LUA_INCLUDE_DIR}") - SET(WITH_LUA 1) - ELSE(LUA_INCLUDE_DIR) - SET(ENABLE_LUA "OFF") - MESSAGE(STATUS "Lua not found, lua support disabled") - ENDIF(LUA_INCLUDE_DIR) - ELSE(NOT LUA_FOUND) - SET(WITH_LUA 1) - INCLUDE_DIRECTORIES("${LUA_INCLUDE_DIR}") - ENDIF(NOT LUA_FOUND) -ENDIF(ENABLE_LUA MATCHES "ON") + +INCLUDE(FindLua51) +IF(NOT LUA_FOUND) + # Automatic check failed, check passed variable + IF(LUA_INCLUDE_DIR) + INCLUDE_DIRECTORIES("${LUA_INCLUDE_DIR}") + SET(WITH_LUA 1) + ELSE(LUA_INCLUDE_DIR) + MESSAGE(FATAL_ERROR "Lua not found, lua support is required for working") + ENDIF(LUA_INCLUDE_DIR) +ELSE(NOT LUA_FOUND) + SET(WITH_LUA 1) + INCLUDE_DIRECTORIES("${LUA_INCLUDE_DIR}") +ENDIF(NOT LUA_FOUND) # Lex and yacc FIND_PROGRAM(LEX_EXECUTABLE lex) @@ -429,9 +422,7 @@ SET(RSPAMDSRC src/modules.c IF(ENABLE_PERL MATCHES "ON") LIST(APPEND RSPAMDSRC src/perl.c) ENDIF(ENABLE_PERL MATCHES "ON") -IF(ENABLE_LUA MATCHES "ON") - ADD_SUBDIRECTORY(src/lua) -ENDIF(ENABLE_LUA MATCHES "ON") +ADD_SUBDIRECTORY(src/lua) ADD_SUBDIRECTORY(src/json) ADD_SUBDIRECTORY(src/evdns) @@ -545,10 +536,8 @@ IF(PERL_EXECUTABLE) ADD_DEPENDENCIES(rspamd perlmodule) ENDIF(PERL_EXECUTABLE) -IF(ENABLE_LUA MATCHES "ON") - TARGET_LINK_LIBRARIES(rspamd rspamd_lua) - TARGET_LINK_LIBRARIES(rspamd "${LUA_LIBRARY}") -ENDIF(ENABLE_LUA MATCHES "ON") +TARGET_LINK_LIBRARIES(rspamd rspamd_lua) +TARGET_LINK_LIBRARIES(rspamd "${LUA_LIBRARY}") TARGET_LINK_LIBRARIES(rspamd m) IF(LIBUTIL_LIBRARY) @@ -673,10 +662,8 @@ ENDIF(NOT EXISTS ${ETC_PREFIX}/rspamd/lotto.inc) INSTALL(FILES conf/rspamd.conf.sample DESTINATION ${ETC_PREFIX}/) # Lua plugins -IF(ENABLE_LUA MATCHES "ON") - INSTALL(CODE "EXECUTE_PROCESS(COMMAND ${CMAKE_COMMAND} -E make_directory ${ETC_PREFIX}/rspamd/plugins)") - INSTALL(DIRECTORY src/plugins/lua DESTINATION ${ETC_PREFIX}/rspamd/plugins PATTERN "*.lua") -ENDIF(ENABLE_LUA MATCHES "ON") +INSTALL(CODE "EXECUTE_PROCESS(COMMAND ${CMAKE_COMMAND} -E make_directory ${ETC_PREFIX}/rspamd/plugins)") +INSTALL(DIRECTORY src/plugins/lua DESTINATION ${ETC_PREFIX}/rspamd/plugins PATTERN "*.lua") # Perl lib IF(PERL_EXECUTABLE) -- cgit v1.2.3