aboutsummaryrefslogtreecommitdiff
path: root/CMakeLists.txt
blob: c69054331f37e3f38d4a2a9da5c74fd03bdfc014 (plain) (blame)
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
cmake_minimum_required(VERSION 3.20)
project(do C)

set(CMAKE_C_STANDARD 99)
set(ASAN "Enable address analyzer" OFF)
add_compile_definitions(_GNU_SOURCE)

if (ASAN)
    set(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -fsanitize=address \
        -fsanitize-recover=address \
        -fsanitize-address-use-after-scope \
        -fno-omit-frame-pointer \
        -fno-inline \
        -g -O0"
    )

    add_link_options(-fsanitize=address)
    add_link_options(-lubsan)
endif()

add_executable(do main.c
        str.c
        str.h
        targetlist.c
        targetlist.h
        common.h
        target.c
        target.h)