Browse Source

Libeval: Use add_custom_target so grammar.c won't be cleaned

If you use add_custom_command to generate the grammar file,
it can be removed by "make clean". This then means the user will
need to get it back from Git, or regenerate it with Lemon.

Changing to add_custom_command removes the output file
from the clean list. The incantation to rebuild the grammar
remains the same: "make libeval_grammar", and it is still not
required to have lemon installed for a normal build.

Fixes: lp:1809610
* https://bugs.launchpad.net/kicad/+bug/1809610
pull/13/head
John Beard 7 years ago
committed by Seth Hillbrand
parent
commit
5e705347bb
  1. 11
      common/libeval/CMakeLists.txt

11
common/libeval/CMakeLists.txt

@ -24,20 +24,15 @@ find_program(LEMON lemon)
if( LEMON )
macro( generate_lemon_grammar GRAMMAR_LEMON GRAMMAR_C )
add_custom_command(
macro( generate_lemon_grammar TGT_NAME GRAMMAR_LEMON GRAMMAR_C )
add_custom_target( ${TGT_NAME}
DEPENDS ${GRAMMAR_LEMON}
OUTPUT ${CMAKE_CURRENT_SOURCE_DIR}/${GRAMMAR_C}
COMMAND ${LEMON} -q ${GRAMMAR_LEMON}
COMMENT "Running Lemon on ${GRAMMAR_LEMON} -> ${GRAMMAR_C}"
WORKING_DIRECTORY ${CMAKE_CURRENT_SOURCE_DIR}
)
endmacro()
generate_lemon_grammar( grammar.lemon grammar.c )
add_custom_target(libeval_grammar
DEPENDS grammar.c
)
generate_lemon_grammar( libeval_grammar grammar.lemon grammar.c )
endif()
Loading…
Cancel
Save