Revert "TODO epan/dissectors/asn1/kerberos/packet-kerberos-template.c new GSS flags"
[wireshark-sm.git] / cmake / modules / FindLEX.cmake
blob473b843e57c81b09ef3ae0c03db6f777f09ef083
2 # - Find flex/lex executable
5 include(FindChocolatey)
7 find_program(LEX_EXECUTABLE
8   NAMES
9     win_flex
10     flex
11     lex
12   PATHS
13     ${CHOCOLATEY_BIN_PATH}
14     /bin
15     /usr/bin
16     /usr/local/bin
17     /sbin
20 INCLUDE(FindPackageHandleStandardArgs)
21 FIND_PACKAGE_HANDLE_STANDARD_ARGS(LEX DEFAULT_MSG LEX_EXECUTABLE)
23 MARK_AS_ADVANCED(LEX_EXECUTABLE)
25 # flex a .l file
27 MACRO(ADD_LEX_FILES _source _generated)
28     FOREACH (_current_FILE ${ARGN})
29       GET_FILENAME_COMPONENT(_in ${_current_FILE} ABSOLUTE)
30       GET_FILENAME_COMPONENT(_basename ${_current_FILE} NAME_WE)
32       SET(_outc ${CMAKE_CURRENT_BINARY_DIR}/${_basename}.c)
33       SET(_outh ${CMAKE_CURRENT_BINARY_DIR}/${_basename}_lex.h)
35       ADD_CUSTOM_COMMAND(
36         OUTPUT ${_outc} ${_outh}
37         COMMAND ${LEX_EXECUTABLE} $<$<OR:$<CONFIG:Debug>,$<CONFIG:RelWithDebInfo>>:--debug> --outfile=${_outc} --header-file=${_outh} ${_in}
38         DEPENDS ${_in}
39       )
40       LIST(APPEND ${_source} ${_in})
41       LIST(APPEND ${_generated} ${_outc})
42       INCLUDE_DIRECTORIES(${CMAKE_CURRENT_SOURCE_DIR})
43       INCLUDE_DIRECTORIES(${CMAKE_CURRENT_BINARY_DIR})
44     ENDFOREACH (_current_FILE)
45 ENDMACRO(ADD_LEX_FILES)