# This file is part of LyX, the document processor.
# Licence details can be found in the file COPYING.
#
# Copyright (c) 2006, Peter Kmmel, <syntheticpp@gmx.net>
#

project(tex2lyx)



set(LINKED_FILES
	${TOP_SRC_DIR}/src/FloatList.cpp
	${TOP_SRC_DIR}/src/Floating.cpp
	${TOP_SRC_DIR}/src/Counters.cpp
	${TOP_SRC_DIR}/src/Layout.cpp
	${TOP_SRC_DIR}/src/TextClass.cpp
	${TOP_SRC_DIR}/src/Lexer.cpp
)

set(tex2lyx_sources
	${TOP_SRC_DIR}/src/tex2lyx/boost.cpp
	${TOP_SRC_DIR}/src/tex2lyx/Context.cpp
	${TOP_SRC_DIR}/src/tex2lyx/gettext.cpp
	${TOP_SRC_DIR}/src/tex2lyx/lengthcommon.cpp
	${TOP_SRC_DIR}/src/tex2lyx/Font.cpp
	${TOP_SRC_DIR}/src/tex2lyx/Parser.cpp
	${TOP_SRC_DIR}/src/tex2lyx/tex2lyx.cpp
	${TOP_SRC_DIR}/src/tex2lyx/preamble.cpp
	${TOP_SRC_DIR}/src/tex2lyx/math.cpp
	${TOP_SRC_DIR}/src/tex2lyx/table.cpp
	${TOP_SRC_DIR}/src/tex2lyx/text.cpp
)

set(tex2lyx_headers
	${TOP_SRC_DIR}/src/Layout.h
	${TOP_SRC_DIR}/src/TextClass.h
	${TOP_SRC_DIR}/src/tex2lyx/Spacing.h
	${TOP_SRC_DIR}/src/tex2lyx/Context.h
	${TOP_SRC_DIR}/src/tex2lyx/Font.h
	${TOP_SRC_DIR}/src/tex2lyx/Parser.h
	${TOP_SRC_DIR}/src/tex2lyx/tex2lyx.h
)

include_directories(BEFORE ${TOP_SRC_DIR}/src/tex2lyx)

if(MSVC)
	SET_SOURCE_FILES_PROPERTIES(${tex2lyx_sources} ${LINKED_FILES}
	 	PROPERTIES COMPILE_FLAGS 
		"/DFONT_H /FI${TOP_SRC_DIR}/src/tex2lyx/Font.h /FI${TOP_SRC_DIR}/src/tex2lyx/Spacing.h")
else(MSVC)
	SET_SOURCE_FILES_PROPERTIES(${tex2lyx_sources} ${LINKED_FILES}
	 	PROPERTIES COMPILE_FLAGS 
		"-DFONT_H -include ${TOP_SRC_DIR}/src/tex2lyx/Font.h -include ${TOP_SRC_DIR}/src/tex2lyx/Spacing.h")
endif(MSVC)

#TODO
#if(NOT MERGE_FILES)
	add_executable(tex2lyx ${tex2lyx_sources} ${LINKED_FILES} ${tex2lyx_headers})
#else(NOT MERGE_FILES)
#	set(tex2lyx_sources_all ${tex2lyx_sources} ${LINKED_FILES})
#	lyx_merge_files(${CMAKE_CURRENT_BINARY_DIR}/tex2lyx_allinone.C tex2lyx_sources_all)
#	add_executable(tex2lyx ${CMAKE_CURRENT_BINARY_DIR}/tex2lyx_allinone.C)
#endif(NOT MERGE_FILES)


target_link_libraries(tex2lyx  
	support
	boost_iostreams
	boost_filesystem
	boost_regex
	${QT_QTCORE_LIBRARY} 
	intl
	)
	
if(WIN32)
	target_link_libraries(tex2lyx shlwapi)
endif(WIN32)

if(APPLE)
	target_link_libraries(tex2lyx "-framework Carbon")
endif(APPLE)

project_source_group("${GROUP_CODE}" tex2lyx_sources tex2lyx_headers)

