Browse Source

* update cmake

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

12
CMakeLists.txt

@ -6,14 +6,16 @@ cmake_minimum_required(VERSION 2.6)
include(CTest) include(CTest)
option(HARDENING "Enable hardening options" OFF) 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) option(WITH_PCRE "Build pcre-compatible filter" ON)
set(CMAKE_INSTALL_PREFIX "/usr/local") set(CMAKE_INSTALL_PREFIX "/usr/local")
set(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -Wall -Wextra -pedantic -std=c99") set(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -Wall -Wextra -pedantic -std=c99")
add_definitions("-D_XOPEN_SOURCE=600") 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} -Wformat -Wformat-security -Werror=format-security" )
set(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -fstack-protector --param ssp-buffer-size=4" ) set(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -fstack-protector --param ssp-buffer-size=4" )
add_definitions("-D_FORTIFY_SOURCE=2") add_definitions("-D_FORTIFY_SOURCE=2")
@ -24,8 +26,10 @@ message(STATUS "- CFLAGS : ${CMAKE_C_FLAGS}")
message(STATUS "Prefix : ${CMAKE_INSTALL_PREFIX}") message(STATUS "Prefix : ${CMAKE_INSTALL_PREFIX}")
message(STATUS "Build type : ${CMAKE_BUILD_TYPE}") message(STATUS "Build type : ${CMAKE_BUILD_TYPE}")
message(STATUS "Options:") message(STATUS "Options:")
message(STATUS "- HARDENING: ${HARDENING}") message(STATUS "- WITH_CLIENT : ${WITH_CLIENT}")
message(STATUS "- WITH_PCRE: ${WITH_PCRE}") message(STATUS "- WITH_CSOCKET : ${WITH_CSOCKET}")
message(STATUS "- WITH_HARDENING : ${WITH_HARDENING}")
message(STATUS "- WITH_PCRE : ${WITH_PCRE}")
message(STATUS "Components:") message(STATUS "Components:")
add_subdirectory(src) add_subdirectory(src)

12
src/CMakeLists.txt

@ -1,10 +1,20 @@
set(CMAKE_INCLUDE_CURRENT_DIR ON) 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}) add_executable("f2b" ${SOURCES})
target_link_libraries(f2b "dl") 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") set(SOURCES "strlcpy.c" "backend-test.c" "log.c" "config.c" "backend.c")
add_executable("backend-test" ${SOURCES}) add_executable("backend-test" ${SOURCES})
target_link_libraries("backend-test" "dl") target_link_libraries("backend-test" "dl")

Loading…
Cancel
Save