-
Notifications
You must be signed in to change notification settings - Fork 0
/
CMakeLists.txt
28 lines (21 loc) · 1023 Bytes
/
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
cmake_minimum_required(VERSION 3.5)
# set the project name
project(kaleidoscope)
# specify the C++ standard
set(CMAKE_CXX_STANDARD 14)
set(CMAKE_CXX_STANDARD_REQUIRED True)
# prepare llvm specific flags
execute_process(COMMAND llvm-config --cxxflags COMMAND tr -s "\n" " " OUTPUT_VARIABLE llvm-cxxflags )
execute_process(COMMAND llvm-config --ldflags COMMAND tr -s "\n" " " OUTPUT_VARIABLE llvm-ldflags)
execute_process(COMMAND llvm-config --system-libs COMMAND tr -s "\n" " " OUTPUT_VARIABLE llvm-system-libs)
execute_process(COMMAND llvm-config --libs core native COMMAND tr -s "\n" " " OUTPUT_VARIABLE llvm-libs)
string(CONCAT llvm-flags ${llvm-cxxflags} ${llvm-ldflags} ${llvm-system-libs} ${llvm-libs})
# set cxx flags
set(CMAKE_CXX_FLAGS "${llvm-flags} -Wno-unused-command-line-argument")
# add a lib
add_library(irgen src/lexer.cpp src/parser.cpp src/codegen.cpp)
# add the executable
add_executable(klc src/klc.cpp)
target_link_libraries(klc PUBLIC irgen)
# installation
install(TARGETS klc DESTINATION bin)