Find bison executable and provide a macro to generate custom build rules.
The module defines the following variables:
The minimum required version of bison can be specified using the standard CMake syntax, e.g. find_package(BISON 2.1.3).
If bison is found, the module defines the macro:
BISON_TARGET(<Name> <YaccInput> <CodeOutput>
[COMPILE_FLAGS <flags>]
[DEFINES_FILE <file>]
[VERBOSE [<file>]]
[REPORT_FILE <file>]
)
which will create a custom rule to generate a parser. <YaccInput> is the path to a yacc file. <CodeOutput> is the name of the source file generated by bison. A header file is also be generated, and contains the token list.
The options are:
The macro defines the following variables:
Example usage:
find_package(BISON)
BISON_TARGET(MyParser parser.y ${CMAKE_CURRENT_BINARY_DIR}/parser.cpp
DEFINES_FILE ${CMAKE_CURRENT_BINARY_DIR}/parser.h)
add_executable(Foo main.cpp ${BISON_MyParser_OUTPUTS})