-
Notifications
You must be signed in to change notification settings - Fork 0
/
CMakeLists.txt
48 lines (36 loc) · 1.08 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
# ANALYSE SYNTAXIQUE EN 3-EME ANNEE DE LICENCE INFORMATIQUE
# Utiliser Flex et Bison pour générer un interpréteur de langage Turtle
cmake_minimum_required(VERSION 2.8)
project(TURTLE C)
if(NOT UNIX)
SET(BISON_EXECUTABLE "..\\flex-bison-windows\\win_bison.exe")
SET(FLEX_EXECUTABLE "..\\flex-bison-windows\\win_flex.exe")
#Windows (with Flex and Bison installed)
endif()
find_package(BISON)
find_package(FLEX)
set(CMAKE_C_FLAGS "-Wall -std=c99 -O2 -g")
bison_target(turtle-parser
turtle-parser.y
${CMAKE_CURRENT_BINARY_DIR}/turtle-parser.c
COMPILE_FLAGS "-v"
)
flex_target(turtle-lexer
turtle-lexer.l
${CMAKE_CURRENT_BINARY_DIR}/turtle-lexer.c
DEFINES_FILE "${CMAKE_CURRENT_BINARY_DIR}/turtle-lexer.h"
)
add_flex_bison_dependency(turtle-lexer turtle-parser)
include_directories(${CMAKE_CURRENT_SOURCE_DIR})
include_directories(${CMAKE_CURRENT_BINARY_DIR})
add_executable(turtle
turtle.c
turtle-ast.c
${BISON_turtle-parser_OUTPUTS}
${FLEX_turtle-lexer_OUTPUTS}
)
target_link_libraries(turtle m)
target_compile_definitions(turtle
PRIVATE
_POSIX_C_SOURCE=200809L
)