Browse Source

* update cmake

master
Alex 'AdUser' Z 9 years ago
parent
commit
ae5c3ab900
  1. 14
      CMakeLists.txt
  2. 12
      src/CMakeLists.txt

14
CMakeLists.txt

@ -6,14 +6,16 @@ cmake_minimum_required(VERSION 2.6)
include(CTest)
option(HARDENING "Enable hardening options" OFF)
option(WITH_PCRE "Build pcre-compatible filter" ON)
option(WITH_CLIENT "Simple client for configuring daemon" ON)
option(WITH_CSOCKET "Unix control socket support for daemon" ON)
option(WITH_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")
add_definitions("-D_XOPEN_SOURCE=600")
if (HARDENING)
if (WITH_HARDENING)
set(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -Wformat -Wformat-security -Werror=format-security" )
set(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -fstack-protector --param ssp-buffer-size=4" )
add_definitions("-D_FORTIFY_SOURCE=2")
@ -24,8 +26,10 @@ message(STATUS "- CFLAGS : ${CMAKE_C_FLAGS}")
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 "- WITH_CLIENT : ${WITH_CLIENT}")
message(STATUS "- WITH_CSOCKET : ${WITH_CSOCKET}")
message(STATUS "- WITH_HARDENING : ${WITH_HARDENING}")
message(STATUS "- WITH_PCRE : ${WITH_PCRE}")
message(STATUS "Components:")
add_subdirectory(src)

12
src/CMakeLists.txt

@ -1,10 +1,20 @@
set(CMAKE_INCLUDE_CURRENT_DIR ON)
set(SOURCES "main.c" "strlcpy.c" "logfile.c" "log.c" "matches.c" "ipaddr.c" "filelist.c" "filter.c" "config.c" "jail.c" "backend.c")
set(SOURCES "daemon.c" "strlcpy.c" "logfile.c" "log.c" "matches.c" "ipaddr.c" "filelist.c" "filter.c" "config.c" "jail.c" "backend.c")
if (WITH_CSOCKET)
list(APPEND SOURCES "csocket.c" "cmsg.c")
add_definitions("-DWITH_CSOCKET")
endif ()
add_executable("f2b" ${SOURCES})
target_link_libraries(f2b "dl")
if (WITH_CLIENT)
set(SOURCES "strlcpy.c" "log.c" "client.c" "cmsg.c" "commands.c" "csocket.c")
add_executable("f2bc" ${SOURCES})
endif ()
set(SOURCES "strlcpy.c" "backend-test.c" "log.c" "config.c" "backend.c")
add_executable("backend-test" ${SOURCES})
target_link_libraries("backend-test" "dl")

Loading…
Cancel
Save