mirror of
https://github.com/Kitware/CMake.git
synced 2026-01-07 06:09:52 -06:00
Merge topic 'patch-flex-bison-docs'
1dcd38bdd0 FindBISON: Update documentation
Acked-by: Kitware Robot <kwrobot@kitware.com>
Merge-request: !10126
This commit is contained in:
@@ -9,30 +9,34 @@ Find ``bison`` executable and provide a macro to generate custom build rules.
|
||||
|
||||
The module defines the following variables:
|
||||
|
||||
``BISON_FOUND``
|
||||
True if the program was found.
|
||||
|
||||
``BISON_EXECUTABLE``
|
||||
path to the ``bison`` program
|
||||
The path to the ``bison`` program.
|
||||
|
||||
``BISON_VERSION``
|
||||
version of ``bison``
|
||||
|
||||
``BISON_FOUND``
|
||||
"True" if the program was found
|
||||
The version of ``bison``.
|
||||
|
||||
The minimum required version of ``bison`` can be specified using the
|
||||
standard CMake syntax, e.g. :command:`find_package(BISON 2.1.3)`.
|
||||
standard CMake syntax, e.g. :command:`find_package(BISON 2.1.3)`.
|
||||
|
||||
If ``bison`` is found, the module defines the macro::
|
||||
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>]
|
||||
)
|
||||
.. command:: bison_target
|
||||
|
||||
.. code-block:: cmake
|
||||
|
||||
bison_target(<Name> <YaccInput> <CodeOutput>
|
||||
[COMPILE_FLAGS <string>]
|
||||
[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
|
||||
generated by bison. A header file can also be generated, and contains
|
||||
the token list.
|
||||
|
||||
.. versionchanged:: 3.14
|
||||
@@ -41,8 +45,9 @@ the token list.
|
||||
|
||||
The options are:
|
||||
|
||||
``COMPILE_FLAGS <flags>``
|
||||
Specify flags to be added to the ``bison`` command line.
|
||||
``COMPILE_FLAGS <string>``
|
||||
Space-separated bison options added to the ``bison`` command line.
|
||||
A :ref:`;-list <CMake Language Lists>` will not work.
|
||||
|
||||
``DEFINES_FILE <file>``
|
||||
.. versionadded:: 3.4
|
||||
@@ -65,29 +70,31 @@ The options are:
|
||||
The macro defines the following variables:
|
||||
|
||||
``BISON_<Name>_DEFINED``
|
||||
``True`` is the macro ran successfully
|
||||
True if the macro ran successfully.
|
||||
|
||||
``BISON_<Name>_INPUT``
|
||||
The input source file, an alias for <YaccInput>
|
||||
The input source file, an alias for ``<YaccInput>``.
|
||||
|
||||
``BISON_<Name>_OUTPUT_SOURCE``
|
||||
The source file generated by bison
|
||||
The source file generated by ``bison``.
|
||||
|
||||
``BISON_<Name>_OUTPUT_HEADER``
|
||||
The header file generated by bison
|
||||
The header file generated by ``bison``.
|
||||
|
||||
``BISON_<Name>_OUTPUTS``
|
||||
All files generated by bison including the source, the header and the report
|
||||
All files generated by ``bison`` including the source, the header and the
|
||||
report.
|
||||
|
||||
``BISON_<Name>_COMPILE_FLAGS``
|
||||
Options used in the ``bison`` command line
|
||||
Options used in the ``bison`` command line.
|
||||
|
||||
Example usage:
|
||||
Examples
|
||||
^^^^^^^^
|
||||
|
||||
.. code-block:: cmake
|
||||
|
||||
find_package(BISON)
|
||||
BISON_TARGET(MyParser parser.y ${CMAKE_CURRENT_BINARY_DIR}/parser.cpp
|
||||
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})
|
||||
#]=======================================================================]
|
||||
|
||||
Reference in New Issue
Block a user