-
Notifications
You must be signed in to change notification settings - Fork 1
Expand file tree
/
Copy pathCMakeLists.txt
More file actions
38 lines (28 loc) · 1.2 KB
/
Copy pathCMakeLists.txt
File metadata and controls
38 lines (28 loc) · 1.2 KB
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
cmake_minimum_required(VERSION 3.11)
project(GeneratorBase)
# Ensure tool dependencies.
include(ExternalProject) # Required to download and build external projects (i.e. ANTLR).
find_package(Git REQUIRED) # Need git to download ANTLR through ExternalProject.
find_package(Java COMPONENTS Runtime REQUIRED) # Need java to run ANTLR, but only the runtime.
# Link against the pthreads library to make std::call_once
# in generated ANTLR code to run without producing system errors
# (see issue https://github.com/antlr/antlr4/issues/3708).
set(THREADS_PREFER_PTHREAD_FLAG TRUE)
find_package(Threads REQUIRED)
# Set C++ standards.
set(CMAKE_CXX_STANDARD 17)
# Add CXX flags.
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -Wall")
# Include cmake utilities.
include("${CMAKE_SOURCE_DIR}/cmake/symlink_to_bin.cmake")
# Grab ANTLR.
include("${CMAKE_SOURCE_DIR}/cmake/get_antlr.cmake")
# Set up paths and info to generate ANTLR sources with.
set(GRAMMAR_NAME "Generator")
set(ANTLR_NAMESPACE "generator")
# Generate sources.
include("${CMAKE_SOURCE_DIR}/cmake/antlr_generate.cmake")
# Include project headers.
include_directories("${CMAKE_SOURCE_DIR}/include")
# Build the source directory.
add_subdirectory("${CMAKE_SOURCE_DIR}/src")