-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathCMakeLists.txt
44 lines (35 loc) · 1.44 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
cmake_minimum_required(VERSION 3.25)
project(SPL)
set(CMAKE_CXX_STANDARD 23)
set(CMAKE_CXX_STANDARD_REQUIRED ON)
add_compile_options(-O3)
file(GLOB_RECURSE TEST_SOURCES tests/*.cpp)
file(GLOB_RECURSE SOURCES src/*.cpp)
set(LEXER_DIR "${CMAKE_CURRENT_BINARY_DIR}")
set(PARSER_DIR "${CMAKE_CURRENT_BINARY_DIR}")
set(LEXER_OUT "${LEXER_DIR}/lexer.cpp")
set(PARSER_OUT "${PARSER_DIR}/parser.cpp")
include_directories(./include)
include_directories(${CMAKE_CURRENT_BINARY_DIR})
find_package(FLEX REQUIRED)
find_package(BISON REQUIRED)
include(FetchContent)
FetchContent_Declare(
googletest
URL https://github.com/google/googletest/archive/03597a01ee50ed33e9dfd640b249b4be3799d395.zip
)
set(gtest_force_shared_crt ON CACHE BOOL "" FORCE)
FetchContent_MakeAvailable(googletest)
enable_testing()
include_directories(libs/linenoise-ng/include)
add_library(linenoise STATIC
libs/linenoise-ng/src/linenoise.cpp
libs/linenoise-ng/src/wcwidth.cpp
libs/linenoise-ng/src/ConvertUTF.cpp)
flex_target(lexer src/lexer.l "${LEXER_OUT}" DEFINES_FILE ${LEXER_DIR}/lexer.h)
bison_target(parser src/parser.y "${PARSER_OUT}" DEFINES_FILE ${PARSER_DIR}/parser.h)
add_flex_bison_dependency(lexer parser)
add_executable(SPL main.cpp ${SOURCES} ${LEXER_OUT} ${PARSER_OUT})
add_executable(tests ${TEST_SOURCES} ${SOURCES} ${LEXER_OUT} ${PARSER_OUT})
target_link_libraries(SPL linenoise)
target_link_libraries(tests GTest::gtest_main GTest::gmock_main)