Browse Source

* update cmake

master
Alex 'AdUser' Z 9 years ago
parent
commit
e3131755c6
  1. 21
      CMakeLists.txt
  2. 9
      src/backends/CMakeLists.txt
  3. 9
      src/filters/CMakeLists.txt

21
CMakeLists.txt

@ -4,13 +4,30 @@ set(VERSION 0.07)
project(${CNAME} C)
cmake_minimum_required(VERSION 2.6)
include(CTest)
option(HARDENING "Enable nardening options" OFF)
set(CMAKE_INSTALL_PREFIX "/usr/local")
set(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -Wall -Wextra -pedantic -std=c99")
add_definitions("-D_XOPEN_SOURCE=600")
include(CTest)
if (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")
endif ()
message(STATUS "Compiler : ${CMAKE_C_COMPILER} (${CMAKE_C_COMPILER_ID} ${CMAKE_C_COMPILER_VERSION})")
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 "Components:")
add_subdirectory(src)
add_subdirectory(t)
set_property(DIRECTORY "t" PROPERTY COMPILE_FLAGS "-g;-ggdb;-Wall;-Wextra;-pedantic;-O0")
install(DIRECTORY "docs" DESTINATION "${CMAKE_INSTALL_PATH}/share/doc/f2b/")

9
src/backends/CMakeLists.txt

@ -1,3 +1,10 @@
set(CMAKE_INCLUDE_CURRENT_DIR ON)
set(BACKENDS "")
add_library("f2b_b_exec" SHARED "exec.c")
add_library("f2b_backend_exec" MODULE "exec.c")
list(APPEND BACKENDS "f2b_backend_exec")
message(STATUS "- Backends : ${BACKENDS}")
install(TARGETS ${BACKENDS}
LIBRARY DESTINATION "${CMAKE_INSTALL_PREFIX}/lib")

9
src/filters/CMakeLists.txt

@ -1,3 +1,10 @@
set(CMAKE_INCLUDE_CURRENT_DIR ON)
set(FILTERS "")
add_library("f2b_f_preg" SHARED "preg.c")
add_library("f2b_filter_preg" MODULE "preg.c")
list(APPEND FILTERS "f2b_filter_preg")
message(STATUS "- Filters : ${FILTERS}")
install(TARGETS ${FILTERS}
LIBRARY DESTINATION "${CMAKE_INSTALL_PREFIX}/lib")

Loading…
Cancel
Save