c++ - Bison & Flex cmake configuration -


i have makefile file manage building of bison&flex&c++ project:

cflags = -g all:      cppcalc cppcalc:    cppcalc.lex.o cppcalc.tab.o     c++ -g -o $@ cppcalc.tab.o cppcalc.lex.o -lm cppcalc.lex.o: cppcalc.lex.c cppcalc.tab.hh cppcalc-ctx.hh     c++ -c $< cppcalc.tab.o: cppcalc.tab.cc cppcalc-ctx.hh klasa.hh cppcalc.lex.c: cppcalc.l     flex -ocppcalc.lex.c cppcalc.l cppcalc.tab.cc cppcalc.tab.hh: cppcalc.yy     bison -vd cppcalc.yy 

this works right. convert think cmake. right wrote below, getting errors after typed make , have no idea wrong:

cmake_minimum_required(version 2.8)  find_package(bison) find_package(flex)  bison_target(myparser cppcalc.yy ${cmake_current_binary_dir}/cppcalc.tab.cc compile_flags -vd) flex_target(myscanner cppcalc.l  ${cmake_current_binary_dir}/cppcalc.lex.c) add_flex_bison_dependency(myscanner myparser)   include_directories(${cmake_current_binary_dir})  add_executable(foo     ${bison_myparser_outputs}     ${flex_myscanner_outputs}     cppcalc-ctx.hh     klasa.hh  ) 

output

cmake_minimum_required(version 2.8)  find_package(bison 2.4.1) find_package(flex 2.5.35)  bison_target(myparser cppcalc.yy ${cmake_current_binary_dir}/cppcalc.tab.cpp) flex_target(myscanner cppcalc.l  ${cmake_current_binary_dir}/lexer.cpp) add_flex_bison_dependency(myscanner myparser)  include_directories(${cmake_current_binary_dir}) include_directories(${cmake_current_source_dir}) add_executable(calc   ${bison_myparser_outputs}   ${flex_myscanner_outputs} ) 

Comments