find_program(LEXESIS_EXE Lexesis PATH "${CMAKE_CURRENT_SOURCE_DIR}/../../../build/bin")

add_custom_command(DEPENDS "${CMAKE_CURRENT_SOURCE_DIR}/xmllexer.lxs"
    COMMAND ${LEXESIS_EXE} ARGS -d "${CMAKE_CURRENT_BINARY_DIR}" -n XMLLexer "${CMAKE_CURRENT_SOURCE_DIR}/xmllexer.lxs"
    OUTPUT "${CMAKE_CURRENT_BINARY_DIR}/XMLLexer.h" "${CMAKE_CURRENT_BINARY_DIR}/XMLLexer.cpp"
    )

add_custom_command(DEPENDS "${CMAKE_CURRENT_SOURCE_DIR}/attributelexer.lxs"
    COMMAND ${LEXESIS_EXE} ARGS -d "${CMAKE_CURRENT_BINARY_DIR}" -n AttributeLexer "${CMAKE_CURRENT_SOURCE_DIR}/attributelexer.lxs"
    OUTPUT "${CMAKE_CURRENT_BINARY_DIR}/AttributeLexer.h" "${CMAKE_CURRENT_BINARY_DIR}/AttributeLexer.cpp"
    )

include_directories("${CMAKE_CURRENT_BINARY_DIR}")

add_executable(highlighter
    highlighter.cpp
    main.cpp
    "${CMAKE_CURRENT_BINARY_DIR}/AttributeLexer.cpp"
    "${CMAKE_CURRENT_BINARY_DIR}/XMLLexer.cpp"
)
