[CMake] Bison extra headers

Hilton Medeiros medeiros.hilton at gmail.com
Thu Feb 11 13:01:30 EST 2010


FYI, I won't put these in the issues tracker because I really don't
think these should be solved by the FindBISON module.

On Thu, 11 Feb 2010 10:57:44 -0200
Hilton Medeiros <medeiros.hilton at gmail.com> wrote:

> Hello,
> 
> I'm using bison_target() from FindBISON with the C++ bison interface,
> on CMake 2.8.0. When using this interface the following extra files
> are generated by bison:
> 
> location.hh
> position.hh
> stack.hh
> 
> They do not get listed in BISON_target_OUTPUTS and do not get erased
> in 'make clean'. 
> 
> See here:
> http://www.gnu.org/software/bison/manual/html_node/C_002b_002b-Bison-Interface.html
> 
> Note that this manual seems outdated, there is no 'lalr1.c' for me,
> only 'lalr1.cc' on bison 2.4.1. Anyway, this is a very small issue,
> this is the workaround I'm using:
> 
> set (BISON_EXTRA_HEADERS
>     ${PROJECT_BINARY_DIR}/position.hh
>     ${PROJECT_BINARY_DIR}/location.hh
>     ${PROJECT_BINARY_DIR}/stack.hh
> )
> 
> set_property(DIRECTORY APPEND PROPERTY ADDITIONAL_MAKE_CLEAN_FILES
> "${BISON_EXTRA_HEADERS}")
> 
> By the way, I saw that the main header file generated on
> bison_target() is always terminated by '.hpp'. I tried to bypass this
> with:
> 
> bison_target (PARSER ${PARSER_FILE} ${PROJECT_BINARY_DIR}/Parser.cpp
>               COMPILE_FLAGS
> --defines="${PROJECT_BINARY_DIR}/Parser.h")
> 
> But then both Parser.hpp and Parser.h are generated. But this is also
> a very small issue.
> 
> Finally, thanks a lot for supporting bison and flex in CMake.
> 
> Kind regards,
> visibility guy


More information about the CMake mailing list