summaryrefslogtreecommitdiffstats
path: root/02_exercise/CMakeLists.txt
blob: 82df5d5c5eac7dd7f2c4dbda7941d7866c5f524e (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
29
30
31
32
33
34
35
36
37
38
39
40
41
42
cmake_minimum_required(VERSION 3.5)

project(shell C)

set(CMAKE_C_COMPILER gcc)
set(CMAKE_C_STANDARD 11)
set(CMAKE_C_STANDARD_REQUIRED True)
add_compile_definitions(_GNU_SOURCE)


find_package(Sanitizers)

add_executable(prog prog.c)

add_executable(shell shell.c)
target_link_libraries(shell PRIVATE array prompt_utils process builtin)
target_compile_options(shell INTERFACE ${PROJECT_WARNINGS})
add_sanitizers(shell)

add_library(builtin builtins.c)
target_compile_options(builtin INTERFACE ${PROJECT_WARNINGS})

add_library(array array.c ../03_exercise/srv/shell.h)


add_library(prompt_utils prompt_utils.c)
target_link_libraries(prompt_utils PRIVATE array)
target_compile_options(prompt_utils INTERFACE ${PROJECT_WARNINGS})

add_executable(prompt_utils_test prompt_utils_test.c)
target_link_libraries(prompt_utils_test PRIVATE prompt_utils array)


add_library(process process.c)
target_link_libraries(process PRIVATE array)
target_compile_options(process INTERFACE ${PROJECT_WARNINGS})

add_executable(process_test process_test.c)
target_link_libraries(process_test PRIVATE process)