-
Notifications
You must be signed in to change notification settings - Fork 1.6k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Add a check for re2c version #2347
Conversation
CMakeLists.txt
Outdated
endif() | ||
endif() | ||
|
||
if(RE2C_PROPER) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
drop RE2C_PROPER
and use RE2C AND ${RE2C_MAJOR_VERSION} GREATER 1
here?
CMakeLists.txt
Outdated
@@ -69,7 +78,7 @@ if(RE2C) | |||
re2c(${PROJECT_SOURCE_DIR}/src/lexer.in.cc ${PROJECT_BINARY_DIR}/lexer.cc) | |||
add_library(libninja-re2c OBJECT ${PROJECT_BINARY_DIR}/depfile_parser.cc ${PROJECT_BINARY_DIR}/lexer.cc) | |||
else() | |||
message(WARNING "re2c was not found; changes to src/*.in.cc will not affect your build.") | |||
message(WARNING "re2c was not found/used; changes to src/*.in.cc will not affect your build.") |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
re2c <our version number> or later was not found; changes to src/*.in.cc will not affect your build.
find_program(RE2C re2c) | ||
if(RE2C) | ||
execute_process(COMMAND "${RE2C}" --vernum OUTPUT_VARIABLE RE2C_RAW_VERSION) | ||
math(EXPR RE2C_MAJOR_VERSION "${RE2C_RAW_VERSION} / 10000") |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
What does this mean?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
To obtain the version number, use re2c --vernum
, for example:
Ubuntu:~$ re2c --vernum
030000
Then divide the number by 10000 to calculate the major version.
As an improved version of #2346.
In some systems, the provided version of re2c is too low to build the latest release, so an option needs to be provided. For example, on CentOS7, the re2c version is re2c 0.14.3.