TODO epan/dissectors/asn1/kerberos/packet-kerberos-template.c new GSS flags
[wireshark-sm.git] / cmake / modules / UseLemon.cmake
blobbcc4626342c956c5c9e876f82aceaf790ca1be3c
3 find_program(LEMON_EXECUTABLE lemon)
5 if(LEMON_EXECUTABLE)
6         # Use system lemon
7         macro(generate_lemon_file _out _in)
8                 add_custom_command(
9                         OUTPUT
10                                 ${_out}.c
11                                 # These files are generated as side-effect
12                                 ${_out}.h
13                                 ${_out}.out
14                         COMMAND ${LEMON_EXECUTABLE}
15                                 -T/usr/share/lemon/lempar.c
16                                 -d.
17                                 ${_in}
18                         DEPENDS
19                                 ${_in}
20                 )
21         endmacro()
22         add_custom_target(lemon)
23 else()
24         # Compile bundled lemon with support for -- to end options
25         macro(generate_lemon_file _out _in)
26                 add_custom_command(
27                         OUTPUT
28                                 ${_out}.c
29                                 # These files are generated as side-effect
30                                 ${_out}.h
31                                 ${_out}.out
32                         COMMAND $<TARGET_FILE:lemon>
33                                 -T${CMAKE_SOURCE_DIR}/tools/lemon/lempar.c
34                                 -d.
35                                 --
36                                 ${_in}
37                         DEPENDS
38                                 ${_in}
39                                 lemon
40                                 ${CMAKE_SOURCE_DIR}/tools/lemon/lempar.c
41                 )
42         endmacro()
43 endif()
45 macro(ADD_LEMON_FILES _source _generated)
47         foreach (_current_FILE ${ARGN})
48                 get_filename_component(_in ${_current_FILE} ABSOLUTE)
49                 get_filename_component(_basename ${_current_FILE} NAME_WE)
51                 set(_out ${CMAKE_CURRENT_BINARY_DIR}/${_basename})
53                 generate_lemon_file(${_out} ${_in})
55                 list(APPEND ${_source} ${_in})
56                 list(APPEND ${_generated} ${_out}.c)
57         endforeach(_current_FILE)
58 endmacro(ADD_LEMON_FILES)