Yan LR: Also search for executable `antlr`
if (DEPENDENCY_PHASE)
- execute_process (COMMAND antlr4 RESULT_VARIABLE ANTLR_NOT_AVAILABLE OUTPUT_QUIET)
- if (ANTLR_NOT_AVAILABLE)
- remove_plugin (yanlr "ANTLR 4 executable (antlr4) not found")
- endif (ANTLR_NOT_AVAILABLE)
+ execute_process (COMMAND antlr4 RESULT_VARIABLE ANTLR4_NOT_AVAILABLE OUTPUT_QUIET)
+ execute_process (COMMAND antlr RESULT_VARIABLE ANTLR_NOT_AVAILABLE OUTPUT_QUIET)
+ if (ANTLR4_NOT_AVAILABLE AND ANTLR_NOT_AVAILABLE)
+ remove_plugin (yanlr "ANTLR 4 executable (antlr4, antlr) not found")
+ else (ANTLR4_NOT_AVAILABLE AND ANTLR_NOT_AVAILABLE)
+ if (ANTLR4_NOT_AVAILABLE)
+ set (ANTLR_EXECUTABLE antlr)
+ else (ANTLR4_NOT_AVAILABLE)
+ set (ANTLR_EXECUTABLE antlr4)
+ endif (ANTLR4_NOT_AVAILABLE)
+ endif (ANTLR4_NOT_AVAILABLE AND ANTLR_NOT_AVAILABLE)
find_package (ANTLR4CPP QUIET)
if (NOT ANTLR4CPP_FOUND)
@@ -36,7 +43,7 @@ if (DEPENDENCY_PHASE)
yanlr.cpp)
add_custom_command (OUTPUT ${GENERATED_SOURCE_FILES}
- COMMAND antlr4 -Werror -Dlanguage=Cpp -o ${CMAKE_CURRENT_BINARY_DIR} -package antlr ${GRAMMAR_FILE}
+ COMMAND ${ANTLR_EXECUTABLE} -Werror -Dlanguage=Cpp -o ${CMAKE_CURRENT_BINARY_DIR} -package antlr ${GRAMMAR_FILE}
DEPENDS ${GRAMMAR_FILE}
WORKING_DIRECTORY ${CMAKE_CURRENT_SOURCE_DIR})
endif (DEPENDENCY_PHASE)
