2 # - Find flex/lex executable
5 include(FindChocolatey)
7 find_program(LEX_EXECUTABLE
13 ${CHOCOLATEY_BIN_PATH}
20 INCLUDE(FindPackageHandleStandardArgs)
21 FIND_PACKAGE_HANDLE_STANDARD_ARGS(LEX DEFAULT_MSG LEX_EXECUTABLE)
23 MARK_AS_ADVANCED(LEX_EXECUTABLE)
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)
36 OUTPUT ${_outc} ${_outh}
37 COMMAND ${LEX_EXECUTABLE} $<$<OR:$<CONFIG:Debug>,$<CONFIG:RelWithDebInfo>>:--debug> --outfile=${_outc} --header-file=${_outh} ${_in}
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)