-
Notifications
You must be signed in to change notification settings - Fork 0
/
CMakeLists.txt
56 lines (44 loc) · 1.26 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
cmake_minimum_required(VERSION 3.8 FATAL_ERROR)
project(spreadsheet)
set(CMAKE_CXX_STANDARD 17)
if(CMAKE_CXX_COMPILER_ID MATCHES "MSVC")
set(
CMAKE_CXX_FLAGS_DEBUG
"${CMAKE_CXX_FLAGS_DEBUG} /JMC"
)
else()
set(
CMAKE_CXX_FLAGS
"${CMAKE_CXX_FLAGS} -Wall -Wextra -pedantic -Werror -Wno-unused-parameter -Wno-implicit-fallthrough"
)
endif()
set(ANTLR_EXECUTABLE ${CMAKE_CURRENT_SOURCE_DIR}/antlr-4.7.2-complete.jar)
include(${CMAKE_CURRENT_SOURCE_DIR}/FindANTLR.cmake)
add_definitions(
-DANTLR4CPP_STATIC
-D_SILENCE_ALL_CXX17_DEPRECATION_WARNINGS
)
set(WITH_STATIC_CRT OFF CACHE BOOL "Visual C++ static CRT for ANTLR" FORCE)
add_subdirectory(antlr4_runtime)
antlr_target(FormulaParser Formula.g4 LEXER PARSER LISTENER)
include_directories(
${ANTLR4_INCLUDE_DIRS}
${ANTLR_FormulaParser_OUTPUT_DIR}
${CMAKE_CURRENT_SOURCE_DIR}/antlr4_runtime/runtime/src
)
file(GLOB sources
*.cpp
*.h
)
add_executable(
spreadsheet
${ANTLR_FormulaParser_CXX_OUTPUTS}
${sources}
)
target_link_libraries(spreadsheet antlr4_static)
install(
TARGETS spreadsheet
DESTINATION bin
EXPORT spreadsheet
)
set_directory_properties(PROPERTIES VS_STARTUP_PROJECT spreadsheet)