Skip to content

Commit cb5a9c3

Browse files
issue #7778 Build fails with javacc 5.0 (#7779)
* issue #7778 Build fails with javacc 5.0 At the moment doxygen works with javaCC version 7.0.5 but no test is done for the version. The minimum requirement has been set to 7.0.5 javacc does not have an option to retrieve the version though when giving `--version` a bit more information is given, this information is filtered. (an issue has been submitted to javacc to obtain the version information: javacc/javacc#172). * issue #7778 Build fails with javacc 5.0 Version detection did not work for `5.0` (only x.y.z was handled, not x.y) * issue #7778 Build fails with javacc 5.0 Based on a review - `--version` is not a valid option, but present already for future use but - removed double ` if(JAVACC_EXECUTABLE)` - Needed `"${JAVACC_TEMP_VERSION}"` as otherwise when `javacc` is found but cannot be executed a message like: ``` CMake Error at cmake/FindJavacc.cmake:11 (string): string sub-command REGEX, mode MATCH needs at least 5 arguments total to command. Call Stack (most recent call first): vhdlparser/CMakeLists.txt:1 (find_package) ``` would appear - reformulated some status strings * issue #7778 Build fails with javacc 5.0 the `.` was not correctly escaped. * issue #7778 Build fails with javacc 5.0 Another one 7.0........ match, going for the suggested match in the cmake CheckCXXCompilerFlag * issue #7778 Build fails with javacc 5.0 Accidently left debug statement. * issue #7778 Build fails with javacc 5.0 Problem has been fixed upstream for version 7.0.7 and up, not using `--version` but `-version` as all command line arguments are starting with a single '-'. Also it is just the bare version, so small extra test so it will work with all versions.
1 parent d25ced5 commit cb5a9c3

File tree

2 files changed

+22
-1
lines changed

2 files changed

+22
-1
lines changed

cmake/FindJavacc.cmake

Lines changed: 16 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,24 @@
1-
21
find_program(JAVACC_EXECUTABLE NAMES javacc javaCC Javacc JavaCC javacc.bat DOC "path to the javacc executable")
32
mark_as_advanced(JAVACC_EXECUTABLE)
43
if(JAVACC_EXECUTABLE)
54
set(JAVACC_FOUND 1)
65
message(STATUS "The javacc executable: ${JAVACC_EXECUTABLE}")
6+
execute_process(
7+
COMMAND "${JAVACC_EXECUTABLE}" -version
8+
OUTPUT_VARIABLE JAVACC_TEMP_VERSION
9+
)
10+
string(REGEX MATCH ".* ([0-9]+(\\.[0-9]+)+) .*" JAVACC_TEMP_VERSION2_UNUSED "${JAVACC_TEMP_VERSION}")
11+
if(CMAKE_MATCH_1)
12+
set(JAVACC_VERSION ${CMAKE_MATCH_1})
13+
else()
14+
string(REGEX MATCH "([0-9]+(\\.[0-9]+)+)" JAVACC_TEMP_VERSION3_UNUSED "${JAVACC_TEMP_VERSION}")
15+
if(CMAKE_MATCH_1)
16+
set(JAVACC_VERSION ${CMAKE_MATCH_1})
17+
else()
18+
message(STATUS "Unable to determine JavaCC version, using existing files")
19+
set(JAVACC_FOUND 0)
20+
endif()
21+
endif()
722
else()
823
set(JAVACC_FOUND 0)
924
message(STATUS "The javacc executable not found, using existing files")

vhdlparser/CMakeLists.txt

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,11 +1,17 @@
11
find_package(Javacc)
22
if (JAVACC_FOUND)
3+
if (JAVACC_VERSION VERSION_LESS 7.0.5)
4+
message(STATUS " Doxygen requires at least JavaCC version 7.0.5 (installed: ${JAVACC_VERSION})")
5+
message(STATUS " Fall back to JavaCC not installed, using existing files.")
6+
else()
7+
38
add_custom_command(
49
COMMAND ${JAVACC_EXECUTABLE} ${JAVACC_FLAGS} -OUTPUT_DIRECTORY=${CMAKE_SOURCE_DIR}/vhdlparser ${CMAKE_SOURCE_DIR}/vhdlparser/vhdlparser.jj
510
DEPENDS ${CMAKE_SOURCE_DIR}/vhdlparser/vhdlparser.jj
611
OUTPUT ${CMAKE_SOURCE_DIR}/vhdlparser/CharStream.cc ${CMAKE_SOURCE_DIR}/vhdlparser/CharStream.h ${CMAKE_SOURCE_DIR}/vhdlparser/ErrorHandler.h ${CMAKE_SOURCE_DIR}/vhdlparser/ParseException.cc ${CMAKE_SOURCE_DIR}/vhdlparser/ParseException.h ${CMAKE_SOURCE_DIR}/vhdlparser/Token.cc ${CMAKE_SOURCE_DIR}/vhdlparser/Token.h ${CMAKE_SOURCE_DIR}/vhdlparser/TokenManager.h ${CMAKE_SOURCE_DIR}/vhdlparser/TokenMgrError.cc ${CMAKE_SOURCE_DIR}/vhdlparser/TokenMgrError.h ${CMAKE_SOURCE_DIR}/vhdlparser/VhdlParser.cc ${CMAKE_SOURCE_DIR}/vhdlparser/VhdlParser.h ${CMAKE_SOURCE_DIR}/vhdlparser/VhdlParserConstants.h ${CMAKE_SOURCE_DIR}/vhdlparser/VhdlParserTokenManager.cc ${CMAKE_SOURCE_DIR}/vhdlparser/VhdlParserTokenManager.h
712
)
813

14+
endif()
915
endif()
1016

1117
include_directories(${CMAKE_SOURCE_DIR}/src ${CMAKE_SOURCE_DIR}/qtools ${GENERATED_SRC})

0 commit comments

Comments
 (0)