diff --git a/CMakeLists.txt b/CMakeLists.txt index 08e98cf..84399b5 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -7,6 +7,7 @@ cmake_minimum_required(VERSION 2.6) include(CTest) option(HARDENING "Enable hardening options" OFF) +option(WITH_PCRE "Build pcre-compatible filter" ON) set(CMAKE_INSTALL_PREFIX "/usr/local") set(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -Wall -Wextra -pedantic -std=c99") @@ -24,6 +25,7 @@ message(STATUS "Prefix : ${CMAKE_INSTALL_PREFIX}") message(STATUS "Build type : ${CMAKE_BUILD_TYPE}") message(STATUS "Options:") message(STATUS "- HARDENING: ${HARDENING}") +message(STATUS "- WITH_PCRE: ${WITH_PCRE}") message(STATUS "Components:") add_subdirectory(src) diff --git a/src/filters/CMakeLists.txt b/src/filters/CMakeLists.txt index c88dfb5..93c9c30 100644 --- a/src/filters/CMakeLists.txt +++ b/src/filters/CMakeLists.txt @@ -5,7 +5,7 @@ add_library("f2b_filter_preg" MODULE "preg.c") list(APPEND FILTERS "f2b_filter_preg") find_library(PCRE_FOUND "pcre") -if (PCRE_FOUND) +if (WITH_PCRE AND PCRE_FOUND) add_library("f2b_filter_pcre" MODULE "pcre.c") target_link_libraries("f2b_filter_pcre" "pcre") list(APPEND FILTERS "f2b_filter_pcre") diff --git a/t/CMakeLists.txt b/t/CMakeLists.txt index 3010542..405f1b1 100644 --- a/t/CMakeLists.txt +++ b/t/CMakeLists.txt @@ -7,14 +7,16 @@ add_executable("t_matches" "t_matches.c" "${SRC_DIR}/matches.c") add_executable("t_ipaddr" "t_ipaddr.c" "${SRC_DIR}/ipaddr.c" "${SRC_DIR}/matches.c") add_executable("t_config_param" "t_config_param.c" "${SRC_DIR}/config.c" "${SRC_DIR}/log.c") -add_executable("t_filter_preg" "t_filters.c" "${SRC_DIR}/filters/preg.c") -add_executable("t_filter_pcre" "t_filters.c" "${SRC_DIR}/filters/pcre.c") -target_link_libraries("t_filter_pcre" "pcre") - add_test("tests/f2b_logfile_*" "t_logfile") add_test("tests/f2b_matches_*" "t_matches") add_test("tests/f2b_ipaddr_*" "t_ipaddr") add_test("tests/f2b_config_param*" "t_config_param") +add_executable("t_filter_preg" "t_filters.c" "${SRC_DIR}/filters/preg.c") add_test("tests/filter/preg" "t_filter_preg") + +if (WITH_PCRE) add_test("tests/filter/pcre" "t_filter_pcre") +add_executable("t_filter_pcre" "t_filters.c" "${SRC_DIR}/filters/pcre.c") +target_link_libraries("t_filter_pcre" "pcre") +endif ()