generated from JellevanKraaij/cmake-project-template
-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy pathCMakeLists.txt
70 lines (62 loc) · 2.03 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
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
# ------------------------------------- SETTINGS ---------------------------------- #
cmake_minimum_required(VERSION 3.16.3)
project(minishell)
set (MAIN_SRCS src/main.c)
set (UTIL_SRCS
src/error.c
src/signals.c
src/parser/parser.c
src/parser/t_token.c
src/parser/t_command.c
src/parser/t_file.c
src/parser/lexer_process.c
src/parser/utils.c
src/parser/expand_vars.c
src/parser/expand_vars_string.c
src/parser/split_tokens.c
src/parser/parse_tokens.c
src/parser/combine_tokens.c
src/parser/lexer_tokenize_quotes.c
src/parser/lexer_tokenize_sym.c
src/parser/debug.c
src/executor/executor.c
src/executor/builtins/cd.c
src/executor/builtins/echo.c
src/executor/builtins/env.c
src/executor/builtins/exit.c
src/executor/builtins/export.c
src/executor/builtins/export_print.c
src/executor/builtins/pwd.c
src/executor/builtins/unset.c
src/executor/builtins/builtin_utils.c
src/executor/single_cmd.c
src/executor/multiple_cmd.c
src/executor/exec_multiple_cmd.c
src/executor/open_files.c
src/executor/heredoc.c
src/executor/heredoc_utils.c
src/executor/find_executable.c
src/executor/wait_childs.c
src/environment/ft_getenv.c
src/environment/ft_environ.c
src/environment/ft_unsetenv.c
src/environment/ft_setenv.c
)
set (EXEC_NAME minishell)
# compiler settings:
set (CMAKE_C_FLAGS "-Wall -Werror -Wextra")
set (CMAKE_C_FLAGS_DEBUG "-g -fsanitize=address -DBUILD_DEBUG") #cmake -DCMAKE_BUILD_TYPE=DEBUG to add debug flags
set (CMAKE_EXPORT_COMPILE_COMMANDS ON) #vscode include path checking
# enable specific operating settings:
if(APPLE)
include(${CMAKE_CURRENT_SOURCE_DIR}/cmake/mac_options.cmake)
endif()
# add custom libraries:
add_subdirectory(lib/libft)
# ------------------------------------- BUILD ------------------------------------- #
# create executable from source files
add_executable(${EXEC_NAME} ${MAIN_SRCS} ${UTIL_SRCS})
# add project include to executable
target_include_directories(${EXEC_NAME} PRIVATE ${CMAKE_CURRENT_SOURCE_DIR}/include)
# add libs to executable
target_link_libraries(${EXEC_NAME} readline termcap ft)