Find bison
executable and provide a macro to generate custom build rules.
The module defines the following variables:
BISON_EXECUTABLE
bison
programBISON_VERSION
bison
BISON_FOUND
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:
COMPILE_FLAGS <flags>
bison
command line.DEFINES_FILE <file>
<file>
to be generated by bison
.VERBOSE [<file>]
bison
to write a report file of the grammar and parser. If <file>
is given, it specifies path the report file is copied to. [<file>]
is left for backward compatibility of this module. Use VERBOSE REPORT_FILE <file>
.REPORT_FILE <file>
<file>
, if generated.The macro defines the following variables:
BISON_<Name>_DEFINED
BISON_<Name>_INPUT
BISON_<Name>_OUTPUT_SOURCE
BISON_<Name>_OUTPUT_HEADER
BISON_<Name>_OUTPUTS
BISON_<Name>_COMPILE_FLAGS
bison
command lineExample 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})
© 2000–2018 Kitware, Inc. and Contributors
Licensed under the BSD 3-clause License.
https://cmake.org/cmake/help/v3.12/module/FindBISON.html