Browse Source

* make pcre an option

master
Alex 'AdUser' Z 9 years ago
parent
commit
6cd1a4bdc6
  1. 2
      CMakeLists.txt
  2. 2
      src/filters/CMakeLists.txt
  3. 10
      t/CMakeLists.txt

2
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)

2
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")

10
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 ()

Loading…
Cancel
Save