c++ - CMake - How to translate flex and bison targets from Makefile to CMakeLists -


i have small open project uses make call flex , bison. wish migrate cmake. new flex , bison

how ?

src = main.cc sqlparser.tab.c lex.sql.c sqlengine.cc btreeindex.cc btreenode.cc recordfile.cc pagefile.cc  hdr = returncode.h pagefile.h sqlengine.h btreeindex.h btreenode.h recordfile.h sqlparser.tab.h  mydatabase: $(src) $(hdr)     g++ -ggdb -o $@ $(src)  lex.sql.c: sqlparser.l     flex -psql $<  sqlparser.tab.c: sqlparser.y     bison -d -psql $< 

i saw reference here.

i tried follows, cannot compiled.

cmake_minimum_required (version 2.8.11) project (mydatabase)  find_package(bison) find_package(flex)  bison_target(myparser sqlparser.y ${cmake_current_binary_dir}/sqlparser.tab.c compile_flags "-d -psql") flex_target(myscanner sqlparser.l ${cmake_current_binary_dir}/lex.sql.c compile_flags "-psql") add_flex_bison_dependency(myscanner myparser)  include_directories(${cmake_current_binary_dir}) set(source_files main.cc sqlengine.cc btreeindex.cc btreenode.cc recordfile.cc pagefile.cc) set(header_files bruinbase.h pagefile.h sqlengine.h btreeindex.h btreenode.h recordfile.h)  add_executable (mydatabase ${source_files} ${header_files} ${bison_myparser_outputs} ${flex_myscanner_outputs}) 

i got

sqlparser.y:2:10: fatal error: 'cstdio' file not found #include <cstdio> 


Comments

Popular posts from this blog

sql server - Cannot query correctly (MSSQL - PHP - JSON) -

php - trouble displaying mysqli database results in correct order -

C++ Linked List -