diff options
Diffstat (limited to 'Modules/FindBISON.cmake')
-rw-r--r-- | Modules/FindBISON.cmake | 159 |
1 files changed, 80 insertions, 79 deletions
diff --git a/Modules/FindBISON.cmake b/Modules/FindBISON.cmake index 2000f7f..d59dc27 100644 --- a/Modules/FindBISON.cmake +++ b/Modules/FindBISON.cmake @@ -1,85 +1,86 @@ # Distributed under the OSI-approved BSD 3-Clause License. See accompanying # file Copyright.txt or https://cmake.org/licensing for details. -#.rst: -# FindBISON -# --------- -# -# Find ``bison`` executable and provide a macro to generate custom build rules. -# -# The module defines the following variables: -# -# ``BISON_EXECUTABLE`` -# path to the ``bison`` program -# -# ``BISON_VERSION`` -# version of ``bison`` -# -# ``BISON_FOUND`` -# true if the program was 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>`` -# Specify flags to be added to the ``bison`` command line. -# -# ``DEFINES_FILE <file>`` -# Specify a non-default header ``<file>`` to be generated by ``bison``. -# -# ``VERBOSE [<file>]`` -# Tell ``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>`` -# Specify a non-default report ``<file>``, if generated. -# -# The macro defines the following variables: -# -# ``BISON_<Name>_DEFINED`` -# true is the macro ran successfully -# -# ``BISON_<Name>_INPUT`` -# The input source file, an alias for <YaccInput> -# -# ``BISON_<Name>_OUTPUT_SOURCE`` -# The source file generated by bison -# -# ``BISON_<Name>_OUTPUT_HEADER`` -# The header file generated by bison -# -# ``BISON_<Name>_OUTPUTS`` -# All files generated by bison including the source, the header and the report -# -# ``BISON_<Name>_COMPILE_FLAGS`` -# Options used in the ``bison`` command line -# -# Example usage: -# -# .. code-block:: cmake -# -# 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}) +#[=======================================================================[.rst: +FindBISON +--------- + +Find ``bison`` executable and provide a macro to generate custom build rules. + +The module defines the following variables: + +``BISON_EXECUTABLE`` + path to the ``bison`` program + +``BISON_VERSION`` + version of ``bison`` + +``BISON_FOUND`` + true if the program was 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>`` + Specify flags to be added to the ``bison`` command line. + +``DEFINES_FILE <file>`` + Specify a non-default header ``<file>`` to be generated by ``bison``. + +``VERBOSE [<file>]`` + Tell ``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>`` + Specify a non-default report ``<file>``, if generated. + +The macro defines the following variables: + +``BISON_<Name>_DEFINED`` + true is the macro ran successfully + +``BISON_<Name>_INPUT`` + The input source file, an alias for <YaccInput> + +``BISON_<Name>_OUTPUT_SOURCE`` + The source file generated by bison + +``BISON_<Name>_OUTPUT_HEADER`` + The header file generated by bison + +``BISON_<Name>_OUTPUTS`` + All files generated by bison including the source, the header and the report + +``BISON_<Name>_COMPILE_FLAGS`` + Options used in the ``bison`` command line + +Example usage: + +.. code-block:: cmake + + 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}) +#]=======================================================================] find_program(BISON_EXECUTABLE NAMES bison win_bison DOC "path to the bison executable") mark_as_advanced(BISON_EXECUTABLE) |