-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy pathCMakeLists.txt
43 lines (31 loc) · 1.15 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
project(JustRX)
cmake_minimum_required(VERSION 3.13)
set(CMAKE_MODULE_PATH ${CMAKE_SOURCE_DIR}/cmake)
option(DISABLE_TESTS "Skips compiling tests for the library" off)
find_package(BISON REQUIRED)
find_package(FLEX REQUIRED)
set(autogen "${CMAKE_CURRENT_BINARY_DIR}/justrx/autogen")
execute_process(COMMAND ${CMAKE_COMMAND} -E make_directory ${autogen})
FLEX_TARGET(scanner src/re-scan.l ${autogen}/re-scan.c DEFINES_FILE ${autogen}/re-scan.h)
BISON_TARGET(parser src/re-parse.y ${autogen}/re-parse.c COMPILE_FLAGS "-Wno-conflicts-rr -Wno-conflicts-sr")
ADD_FLEX_BISON_DEPENDENCY(scanner parser)
set(SOURCES
src/ccl.c
src/dfa.c
src/dfa-interpreter-std.c
src/dfa-interpreter-min.c
src/jlocale.c
src/jrx.c
src/nfa.c
src/util.c
${BISON_parser_OUTPUTS}
${FLEX_scanner_OUTPUTS}
)
add_library(jrx-objects OBJECT ${SOURCES})
target_compile_options(jrx-objects PRIVATE "-fPIC")
target_include_directories(jrx-objects BEFORE PUBLIC include)
target_include_directories(jrx-objects BEFORE PUBLIC ${CMAKE_CURRENT_BINARY_DIR})
add_library(jrx $<TARGET_OBJECTS:jrx-objects>)
if ( NOT DISABLE_TESTS )
add_subdirectory(src/tests)
endif()