2 # Once done this will define
4 # BISON_FOUND - system has Bison
5 # BISON_EXECUTABLE - path of the bison executable
6 # BISON_VERSION - the version string, like "2.5.31"
10 FIND_PROGRAM(BISON_EXECUTABLE NAMES bison)
15 EXECUTE_PROCESS(COMMAND ${BISON_EXECUTABLE} --version
16 OUTPUT_VARIABLE _BISON_VERSION
18 string (REGEX MATCH "[0-9]+\\.[0-9]+\\.[0-9]+" BISON_VERSION "${_bison_VERSION}")
19 ENDIF(BISON_EXECUTABLE)
22 IF(NOT Bison_FIND_QUIETLY)
23 MESSAGE(STATUS "Found Bison: ${BISON_EXECUTABLE}")
24 ENDIF(NOT Bison_FIND_QUIETLY)
26 IF(Bison_FIND_REQUIRED)
27 MESSAGE(FATAL_ERROR "Could not find Bison")
28 ENDIF(Bison_FIND_REQUIRED)
32 MACRO(BISON_GENERATOR _PREFIX _Y_INPUT _H_OUTPUT _CPP_OUTPUT)
34 GET_FILENAME_COMPONENT(_Y_DIR ${_Y_INPUT} PATH)
39 COMMAND ${BISON_EXECUTABLE}
41 -p ${_PREFIX} -o"${_CPP_OUTPUT}"
42 --defines="${_H_OUTPUT}" ${_Y_INPUT}
43 WORKING_DIRECTORY ${_Y_DIR}
45 SET_SOURCE_FILES_PROPERTIES(
46 ${_CPP_OUTPUT} ${_H_OUTPUT}
49 ELSE(BISON_EXECUTABLE)
50 MESSAGE(SEND_ERROR "Can't find bison program, and it's required")
51 ENDIF(BISON_EXECUTABLE)
52 ENDMACRO(BISON_GENERATOR)