diff options
author | Jan Niklas Hasse <jhasse@bixense.com> | 2023-10-30 07:38:44 (GMT) |
---|---|---|
committer | GitHub <noreply@github.com> | 2023-10-30 07:38:44 (GMT) |
commit | b60a7dd3b88986ffb958abb7ccfcda8a96e0b706 (patch) | |
tree | d564a0acb1c0795ce890472612ff73f35d542ceb | |
parent | 885b4efb41c039789b81f0dc0d67c1ed0faea17c (diff) | |
parent | 9db4889d7abd54f7276b12210705567ab62c3abe (diff) | |
download | Ninja-b60a7dd3b88986ffb958abb7ccfcda8a96e0b706.zip Ninja-b60a7dd3b88986ffb958abb7ccfcda8a96e0b706.tar.gz Ninja-b60a7dd3b88986ffb958abb7ccfcda8a96e0b706.tar.bz2 |
Merge pull request #2347 from sunshaoce/RE2C_PROPER
Add a check for re2c version
-rw-r--r-- | CMakeLists.txt | 7 |
1 files changed, 6 insertions, 1 deletions
diff --git a/CMakeLists.txt b/CMakeLists.txt index d0c62f9..c0745af 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -57,8 +57,13 @@ else() endif() # --- optional re2c +set(RE2C_MAJOR_VERSION 0) 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") +endif() +if(${RE2C_MAJOR_VERSION} GREATER 1) # the depfile parser and ninja lexers are generated using re2c. function(re2c IN OUT) add_custom_command(DEPENDS ${IN} OUTPUT ${OUT} @@ -69,7 +74,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 2 or later was not found; changes to src/*.in.cc will not affect your build.") add_library(libninja-re2c OBJECT src/depfile_parser.cc src/lexer.cc) endif() target_include_directories(libninja-re2c PRIVATE src) |