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(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 (${SAMPLER} STREQUAL "dummy") set(SAMPLER "dummy") else () set(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 "- SAMPLER : ${SAMPLER}") add_subdirectory("src") add_subdirectory("tests") set_property(DIRECTORY "tests" PROPERTY COMPILE_FLAGS "-g;-ggdb;-Wall;-Wextra;-pedantic;-O0")