PROJECT(xmllexer)

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

GET_TARGET_PROPERTY(make_xmllexer_exe make_xmllexer LOCATION)

ADD_CUSTOM_COMMAND(
	OUTPUT "${xmllexer_BINARY_DIR}/XmlLexerCore.h"
	       "${xmllexer_BINARY_DIR}/XmlLexerCore.cpp"
	COMMAND "${make_xmllexer_exe}" XmlLexerCore
	        "${xmllexer_BINARY_DIR}/XmlLexerCore.h"
	        "${xmllexer_BINARY_DIR}/XmlLexerCore.cpp"
		XmlLexerDefinitions XmlLexerDefinitions.h XmlLexer XmlLexer.h
	DEPENDS make_xmllexer XmlLexerDefinitions.h
)

SET(
	built_sources
	"${xmllexer_BINARY_DIR}/XmlLexerCore.h"
	"${xmllexer_BINARY_DIR}/XmlLexerCore.cpp"
)

SET_SOURCE_FILES_PROPERTIES(
	${built_sources} PROPERTIES
	GENERATED TRUE
)

INCLUDE_DIRECTORIES(
	"${xmllexer_SOURCE_DIR}"
	"${xmllexer_BINARY_DIR}"
	"${lexgen_SOURCE_DIR}"
)

ADD_LIBRARY(
	xmllexer STATIC
	XmlLexer.h XmlLexerDefinitions.h
	${built_sources}
)
