PROJECT(htmllexer)

SET(bin_dir ${htmllexer_BINARY_DIR})

ADD_EXECUTABLE(make_htmllexer lexcode.cpp)
TARGET_LINK_LIBRARIES(make_htmllexer lexgen)

GET_TARGET_PROPERTY(make_htmllexer_exe make_htmllexer LOCATION)

ADD_CUSTOM_COMMAND(
	OUTPUT ${bin_dir}/HtmlLexerCore.h ${bin_dir}/HtmlLexerCore.cpp
	COMMAND ${make_htmllexer_exe} HtmlLexerCore
		${bin_dir}/HtmlLexerCore.h ${bin_dir}/HtmlLexerCore.cpp
		HtmlLexerDefinitions HtmlLexerDefinitions.h HtmlLexer HtmlLexer.h
	DEPENDS make_htmllexer HtmlLexerDefinitions.h
)

INCLUDE_DIRECTORIES(
	${htmllexer_SOURCE_DIR}
	${htmllexer_BINARY_DIR}
	${lexgen_SOURCE_DIR}
)

ADD_LIBRARY(
	htmllexer STATIC
	HtmlLexer.h HtmlLexerDefinitions.h
	${bin_dir}/HtmlLexerCore.cpp ${bin_dir}/HtmlLexerCore.h
)

SET_SOURCE_FILES_PROPERTIES(
	${bin_dir}/HtmlLexerCore.cpp ${bin_dir}/HtmlLexerCore.h
	PROPERTIES
	GENERATED TRUE
)