File tree Expand file tree Collapse file tree 1 file changed +6
-1
lines changed
Expand file tree Collapse file tree 1 file changed +6
-1
lines changed Original file line number Diff line number Diff line change @@ -57,8 +57,13 @@ else()
5757endif ()
5858
5959# --- optional re2c
60+ set (RE2C_MAJOR_VERSION 0)
6061find_program (RE2C re2c )
6162if (RE2C)
63+ execute_process (COMMAND "${RE2C} " --vernum OUTPUT_VARIABLE RE2C_RAW_VERSION )
64+ math (EXPR RE2C_MAJOR_VERSION "${RE2C_RAW_VERSION} / 10000" )
65+ endif ()
66+ if (${RE2C_MAJOR_VERSION} GREATER 1)
6267 # the depfile parser and ninja lexers are generated using re2c.
6368 function (re2c IN OUT )
6469 add_custom_command (DEPENDS ${IN} OUTPUT ${OUT}
@@ -69,7 +74,7 @@ if(RE2C)
6974 re2c (${PROJECT_SOURCE_DIR} /src/lexer.in.cc ${PROJECT_BINARY_DIR} /lexer.cc )
7075 add_library (libninja-re2c OBJECT ${PROJECT_BINARY_DIR} /depfile_parser.cc ${PROJECT_BINARY_DIR} /lexer.cc )
7176else ()
72- message (WARNING "re2c was not found; changes to src/*.in.cc will not affect your build." )
77+ message (WARNING "re2c 2 or later was not found; changes to src/*.in.cc will not affect your build." )
7378 add_library (libninja-re2c OBJECT src/depfile_parser.cc src/lexer.cc )
7479endif ()
7580target_include_directories (libninja-re2c PRIVATE src )
You can’t perform that action at this time.
0 commit comments