-
Notifications
You must be signed in to change notification settings - Fork 1
/
CMakeLists.txt
45 lines (34 loc) · 1.04 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
cmake_minimum_required(VERSION 3.8.2)
project(yash VERSION 0.0.8)
# find flex and bison
find_package(BISON)
find_package(FLEX)
# set CXXFLAGS
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -Wall -Wextra")
set(CMAKE_CXX_FLAGS_DEBUG "${CMAKE_CXX_FLAGS} -ggdb3 -fsanitize=address -O0")
set(CMAKE_CXX_FLAGS_RELEASE "${CMAKE_CXX_FLAGS} -O2")
# threads
set(THREADS_PREFER_PTHREAD_FLAG ON)
find_package(Threads REQUIRED)
# source files
set(sources
src/shell-utils.cpp
src/wildcard.cpp
src/command.cpp
src/simple_command.cpp
src/shell-readline.cpp
src/main.cpp
)
# generated files
bison_target(Parser src/shell_bison.yy ${CMAKE_CURRENT_BINARY_DIR}/shell_bison.cc)
flex_target(Scanner src/shell_flex.ll ${CMAKE_CURRENT_BINARY_DIR}/shell_flex.cc)
add_flex_bison_dependency(Scanner Parser)
include_directories(${CMAKE_CURRENT_BINARY_DIR} src)
add_executable(yash
${sources}
${BISON_Parser_OUTPUTS}
${FLEX_Scanner_OUTPUTS}
)
target_link_libraries(yash Threads::Threads)
set_property(TARGET yash PROPERTY CXX_STANDARD 17)
install(TARGETS yash DESTINATION bin)