You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
 
 

48 lines
1.7 KiB

set(CNAME "libsimdb")
set(VERSION 0.4)
set(SOVERSION 1)
project($CNAME C)
cmake_minimum_required(VERSION 2.6)
include(CTest)
include(GNUInstallDirs)
option(WITH_HARDENING "Enable hardening options" ON)
option(WITH_TOOLS "Build library management tools" ON)
set(SIMDB_SAMPLER "magick" CACHE STRING "Library for sampling")
set(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -Wall -Wextra -pedantic -std=c99")
add_definitions("-D_XOPEN_SOURCE=500")
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")
endif ()
if (${SIMDB_SAMPLER} STREQUAL "dummy")
set(SIMDB_SAMPLER "dummy")
elseif (${SIMDB_SAMPLER} STREQUAL "random")
set(SIMDB_SAMPLER "random")
else ()
set(SIMDB_SAMPLER "magick")
endif ()
message(STATUS "Project : ${CNAME} v${VERSION}")
message(STATUS "Compiler : ${CMAKE_C_COMPILER} (${CMAKE_C_COMPILER_ID} ${CMAKE_C_COMPILER_VERSION})")
message(STATUS "- CFLAGS : ${CMAKE_C_FLAGS}")
message(STATUS "Paths:")
message(STATUS "- prefix : ${CMAKE_INSTALL_PREFIX}")
message(STATUS "- binary : ${CMAKE_INSTALL_FULL_BINDIR}")
message(STATUS "- header : ${CMAKE_INSTALL_FULL_INCLUDEDIR}")
message(STATUS "- library : ${CMAKE_INSTALL_FULL_LIBDIR}")
message(STATUS "Build type : ${CMAKE_BUILD_TYPE}")
message(STATUS "Options:")
message(STATUS "- WITH_HARDENING : ${WITH_HARDENING}")
message(STATUS "- WITH_TOOLS : ${WITH_TOOLS}")
message(STATUS "- SIMDB_SAMPLER : ${SIMDB_SAMPLER}")
add_subdirectory("src")
add_subdirectory("tests")
set_property(DIRECTORY "tests" PROPERTY COMPILE_FLAGS "-g;-ggdb;-Wall;-Wextra;-pedantic;-O0")