-
Notifications
You must be signed in to change notification settings - Fork 0
/
CMakeLists.txt
53 lines (40 loc) · 1.32 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
cmake_minimum_required (VERSION 3.8)
# cmake_policy(SET CMP0098 NEW) # use new flex policy
cmake_policy(SET CMP0088 NEW) # use new bison policy
project ("COMP2432_Group_Assignment" C)
set(CMAKE_C_STANDARD 99)
find_package(BISON)
find_package(FLEX)
file(GLOB_RECURSE PROJECT_SOURCES
${PROJECT_SOURCE_DIR}/src/*.c
${PROJECT_SOURCE_DIR}/src/*.cpp
)
add_executable (${PROJECT_NAME} ${PROJECT_SOURCES})
target_include_directories(
${PROJECT_NAME}
PUBLIC ${PROJECT_SOURCE_DIR}/include
)
target_link_libraries(${PROJECT_NAME} PUBLIC "-static")
add_library(klib "${PROJECT_SOURCE_DIR}/extern/klib/kstring.c")
target_include_directories(
klib
PUBLIC ${PROJECT_SOURCE_DIR}/extern/klib/
)
set(PARSER_LOCATION "${PROJECT_SOURCE_DIR}/src/parser")
bison_target(input_parse ${PARSER_LOCATION}/input.y ${CMAKE_CURRENT_BINARY_DIR}/input.parse.c)
flex_target(input_lex ${PARSER_LOCATION}/input.l ${CMAKE_CURRENT_SOURCE_DIR}/input.lex.c)
add_flex_bison_dependency(input_lex input_parse)
add_library(input_parser ${BISON_input_parse_OUTPUTS} ${FLEX_input_lex_OUTPUTS})
target_include_directories(
input_parser
PRIVATE ${CMAKE_CURRENT_SOURCE_DIR} ${CMAKE_CURRENT_BINARY_DIR}
PUBLIC ${PROJECT_SOURCE_DIR}/include
)
target_link_libraries(
input_parser
PUBLIC klib
)
target_link_libraries(
${PROJECT_NAME}
PUBLIC klib input_parser
)