2 IF(NOT DEFINED FLEX_PREFIX_OUTPUTS)
\r
3 SET(FLEX_PREFIX_OUTPUTS FALSE)
\r
4 ENDIF(NOT DEFINED FLEX_PREFIX_OUTPUTS)
\r
6 IF(NOT FLEX_EXECUTABLE)
\r
7 MESSAGE(STATUS "Looking for flex")
\r
8 FIND_PROGRAM(FLEX_EXECUTABLE flex)
\r
10 MESSAGE(STATUS "Looking for flex -- ${FLEX_EXECUTABLE}")
\r
11 ENDIF(FLEX_EXECUTABLE)
\r
12 ENDIF(NOT FLEX_EXECUTABLE)
\r
15 MACRO(FLEX_FILE FILENAME)
\r
16 GET_FILENAME_COMPONENT(PATH "${FILENAME}" PATH)
\r
17 IF(NOT EXISTS "${CMAKE_CURRENT_BINARY_DIR}/${PATH}")
\r
18 FILE(MAKE_DIRECTORY "${CMAKE_CURRENT_BINARY_DIR}/${PATH}")
\r
19 ENDIF(NOT EXISTS "${CMAKE_CURRENT_BINARY_DIR}/${PATH}")
\r
20 IF(FLEX_PREFIX_OUTPUTS)
\r
21 GET_FILENAME_COMPONENT(PREFIX "${FILENAME}" NAME_WE)
\r
22 ELSE(FLEX_PREFIX_OUTPUTS)
\r
24 ENDIF(FLEX_PREFIX_OUTPUTS)
\r
25 SET(OUTFILE "${CMAKE_CURRENT_BINARY_DIR}/${PATH}/lex.${PREFIX}.c")
\r
26 message("generating ${OUTFILE} with ${FLEX_EXECUTABLE} and args -i using ${CMAKE_CURRENT_SOURCE_DIR}/${FILENAME}")
\r
29 COMMAND "${FLEX_EXECUTABLE}"
\r
32 "${CMAKE_CURRENT_SOURCE_DIR}/${FILENAME}"
\r
33 DEPENDS "${CMAKE_CURRENT_SOURCE_DIR}/${FILENAME}")
\r
34 SET_SOURCE_FILES_PROPERTIES("${OUTFILE}" PROPERTIES GENERATED TRUE)
\r
36 ENDIF(FLEX_EXECUTABLE)
\r