blob: 3bbce44a6763506880c3b28603db8b8774a9cc78 (
plain) (
blame)
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
|
function(ensure_antlr)
if(NOT ANTLR3_EXECUTABLE)
find_program(ANTLR3_EXECUTABLE NAMES antlr3)
if (NOT ANTLR3_EXECUTABLE)
message(FATAL_ERROR "Unable to find antlr3 program. Please install antlr3 and make sure executable file present in the $PATH env.")
endif()
endif()
endfunction()
function(run_antlr)
ensure_antlr()
set(options "")
set(oneValueArgs WORKING_DIRECTORY)
set(multiValueArgs OUTPUT DEPENDS ANTLER_ARGS)
cmake_parse_arguments(
RUN_ANTLR3
"${options}"
"${oneValueArgs}"
"${multiValueArgs}"
${ARGN}
)
add_custom_command(
OUTPUT ${RUN_ANTLR3_OUTPUT}
COMMAND ${ANTLR3_EXECUTABLE} ${RUN_ANTLR3_ANTLER_ARGS}
WORKING_DIRECTORY ${RUN_ANTLR3_WORKING_DIRECTORY}
DEPENDS ${RUN_ANTLR3_DEPENDS}
)
endfunction()
|