forked from VisceralLogic/basic
-
Notifications
You must be signed in to change notification settings - Fork 0
/
CMakeLists.txt
69 lines (58 loc) · 1.53 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
# How To Build:
# ------------
# 1. Create the build directory (separate from the source directory),
# and generate the make file:
# rm -rf build
# mkdir build; cd build; cmake ..
#
# More modern versions of cmake support -S/-B, so you could use:
# mkdir build; cmake -S . -B ./build
#
# 2. Run the Makefile:
# make
cmake_minimum_required(VERSION 3.10)
project(
basic VERSION 0.1
DESCRIPTION "BASIC language interpreter"
LANGUAGES C CXX)
find_package(FLEX REQUIRED)
find_package(BISON REQUIRED)
message("prefix: ${CMAKE_FIND_LIBRARY_PREFIXES}")
message("suffix: ${CMAKE_FIND_LIBRARY_SUFFIXES}")
add_executable(basic "")
target_include_directories(basic PUBLIC ${CMAKE_CURRENT_SOURCE_DIR})
target_compile_features(basic PUBLIC cxx_std_17)
set_target_properties(
basic
PROPERTIES
ARCHIVE_OUTPUT_DIRECTORY ${CMAKE_BINARY_DIR}/lib
LIBRARY_OUTPUT_DIRECTORY ${CMAKE_BINARY_DIR}/lib
RUNTIME_OUTPUT_DIRECTORY ${CMAKE_BINARY_DIR}/bin)
# Use .cpp extension to ensure CMake uses C++ compiler to compile them.
flex_target(lexer basic.l "${CMAKE_CURRENT_BINARY_DIR}/lex.yy.cpp")
bison_target(parser basic.y "${CMAKE_CURRENT_BINARY_DIR}/basic.tab.cpp")
target_sources(
basic
PRIVATE
${CMAKE_CURRENT_BINARY_DIR}/lex.yy.cpp
${CMAKE_CURRENT_BINARY_DIR}/basic.tab.cpp
basic.cpp
data.cpp
doubleexpression.cpp
end.cpp
expression.cpp
for.cpp
goto.cpp
ifthen.cpp
let.cpp
multiprogram.cpp
next.cpp
operatorexpression.cpp
parenexpression.cpp
print.cpp
program.cpp
read.cpp
rem.cpp
stringexpression.cpp
variableexpression.cpp
)