-
Notifications
You must be signed in to change notification settings - Fork 0
/
CMakeLists.txt
48 lines (40 loc) · 1.69 KB
/
CMakeLists.txt
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
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")