summaryrefslogtreecommitdiffstats
path: root/cmake/FindJavacc.cmake
diff options
context:
space:
mode:
Diffstat (limited to 'cmake/FindJavacc.cmake')
-rwxr-xr-xcmake/FindJavacc.cmake17
1 files changed, 16 insertions, 1 deletions
diff --git a/cmake/FindJavacc.cmake b/cmake/FindJavacc.cmake
index c7de776..a134020 100755
--- a/cmake/FindJavacc.cmake
+++ b/cmake/FindJavacc.cmake
@@ -1,9 +1,24 @@
-
find_program(JAVACC_EXECUTABLE NAMES javacc javaCC Javacc JavaCC javacc.bat DOC "path to the javacc executable")
mark_as_advanced(JAVACC_EXECUTABLE)
if(JAVACC_EXECUTABLE)
set(JAVACC_FOUND 1)
message(STATUS "The javacc executable: ${JAVACC_EXECUTABLE}")
+ execute_process(
+ COMMAND "${JAVACC_EXECUTABLE}" -version
+ OUTPUT_VARIABLE JAVACC_TEMP_VERSION
+ )
+ string(REGEX MATCH ".* ([0-9]+(\\.[0-9]+)+) .*" JAVACC_TEMP_VERSION2_UNUSED "${JAVACC_TEMP_VERSION}")
+ if(CMAKE_MATCH_1)
+ set(JAVACC_VERSION ${CMAKE_MATCH_1})
+ else()
+ string(REGEX MATCH "([0-9]+(\\.[0-9]+)+)" JAVACC_TEMP_VERSION3_UNUSED "${JAVACC_TEMP_VERSION}")
+ if(CMAKE_MATCH_1)
+ set(JAVACC_VERSION ${CMAKE_MATCH_1})
+ else()
+ message(STATUS "Unable to determine JavaCC version, using existing files")
+ set(JAVACC_FOUND 0)
+ endif()
+ endif()
else()
set(JAVACC_FOUND 0)
message(STATUS "The javacc executable not found, using existing files")