File tree 1 file changed +17
-2
lines changed
1 file changed +17
-2
lines changed Original file line number Diff line number Diff line change @@ -5,9 +5,24 @@ MACRO(FIND_BISON)
5
5
IF (NOT BISON_EXECUTABLE)
6
6
FIND_PROGRAM (BISON_EXECUTABLE bison)
7
7
IF (NOT BISON_EXECUTABLE)
8
- MESSAGE (FATAL_ERROR "Bison not found - aborting" )
9
- ENDIF (NOT BISON_EXECUTABLE)
8
+
9
+ MESSAGE (FATAL_ERROR "Bison not found - aborting" )
10
+
11
+ ELSE (NOT BISON_EXECUTABLE)
12
+
13
+ EXEC_PROGRAM (${BISON_EXECUTABLE} ARGS --version OUTPUT_VARIABLE BISON_VERSION_STR)
14
+ # get first line in case it's multiline
15
+ STRING (REGEX REPLACE "([^\n ]+).*" "\\ 1" FIRST_LINE "${BISON_VERSION_STR} " )
16
+ # get version information
17
+ STRING (REGEX REPLACE ".* ([0-9]+)\\ .([0-9]+)" "\\ 1" BISON_VERSION_MAJOR "${FIRST_LINE} " )
18
+ STRING (REGEX REPLACE ".* ([0-9]+)\\ .([0-9]+)" "\\ 2" BISON_VERSION_MINOR "${FIRST_LINE} " )
19
+ IF (BISON_VERSION_MAJOR LESS 2)
20
+ MESSAGE (FATAL_ERROR "Bison version is too old (${BISON_VERSION_MAJOR} .${BISON_VERSION_MINOR} ). Use 2.0 or higher." )
21
+ ENDIF (BISON_VERSION_MAJOR LESS 2)
22
+
23
+ ENDIF (NOT BISON_EXECUTABLE)
10
24
ENDIF (NOT BISON_EXECUTABLE)
25
+
11
26
ENDMACRO (FIND_BISON)
12
27
13
28
MACRO (ADD_BISON_FILES _sources )
You can’t perform that action at this time.
0 commit comments