CMakeLists.txt 1.15 KB
Newer Older
1 2 3
cmake_minimum_required (VERSION 2.8.11)
project (PRRT)

4
option(PRRT_TESTS "Build tests" OFF)
5
option(GPROF "Compile with profiler" OFF)
6

7 8 9
set(CMAKE_ARCHIVE_OUTPUT_DIRECTORY ${CMAKE_BINARY_DIR})
set(CMAKE_LIBRARY_OUTPUT_DIRECTORY ${CMAKE_BINARY_DIR})
set(CMAKE_RUNTIME_OUTPUT_DIRECTORY ${CMAKE_BINARY_DIR})
10

Andreas Schmidt's avatar
Andreas Schmidt committed
11
set(CMAKE_C_FLAGS "-O2 -Wall -std=gnu11 -D_GNU_SOURCE -fPIC" )
12
set(CMAKE_C_FLAGS_DEBUG "-O0 -fsanitize=undefined -fsanitize=address -g3" )
Stefan Reif's avatar
Stefan Reif committed
13
set(CMAKE_CXX_FLAGS "-fstack-protector -fstack-protector-all -Wall -std=gnu++11 -D_GNU_SOURCE" )
14
set(CMAKE_CXX_FLAGS_DEBUG "-O0 -Wall -ggdb -fsanitize=undefined -fsanitize=address -g3" )
Andreas Schmidt's avatar
Andreas Schmidt committed
15 16
set(CMAKE_CXX_FLAGS_RELEASE "-Os -Wall" )

17 18 19 20
if(GPROF)
    set(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -pg")
    set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -pg")
endif()
21

22
find_package (Threads)
23 24
find_library(M_LIB m)

25

26
include_directories(${CMAKE_CURRENT_SOURCE_DIR})
27

28
add_subdirectory(prrt)
29 30 31 32 33

if(PRRT_TESTS)
    enable_testing()

    add_subdirectory(tests)
34 35

    add_custom_target(funtest COMMAND ./bin/prrtTests)
36
endif()
37

38
add_custom_target(perftest COMMAND python3 tests/eval.py)
39
add_custom_target(memtest COMMAND bash ./memtest.sh DEPENDS sender receiver)