cmake_minimum_required(VERSION 2.6)
project(sphost)

set (SPHOST_MAJOR_VERSION 1)
set (SPHOST_RELEASE_VERSION 0)
set (SPHOST_EPOCH_VERSION 0)

set(sphost_SRCS
	${CUSTOM_INCLUDE_PATH}/sphost/componenthelper.h
	componenthelper.cpp
	${CUSTOM_INCLUDE_PATH}/sphost/configutils.h
	configutils.cpp
	${CUSTOM_INCLUDE_PATH}/sphost/libimpexp_sphost.h
)

if (ENABLE_NLS)
set(sphost_SRCS 
	${sphost_SRCS}
	${CUSTOM_INCLUDE_PATH}/sphost/langutils.h
	langutils.cpp
)
endif(ENABLE_NLS)

# This library could be static

add_library (sphost ${sphost_SRCS})

target_link_libraries(sphost spcore)
target_link_libraries(sphost widgets_base)

# Boost
find_package(Boost COMPONENTS filesystem thread system REQUIRED)
target_link_libraries(sphost ${Boost_FILESYSTEM_LIBRARY})
target_link_libraries(sphost ${Boost_THREAD_LIBRARY})
target_link_libraries(sphost ${Boost_SYSTEM_LIBRARY})

if (ENABLE_NLS)
	target_link_libraries(sphost ${LIBINTL_LIBRARIES})
endif(ENABLE_NLS)

IF(BUILD_SHARED_LIBS)
	add_definitions(-DSPMAKING_DLL_SPHOST)
	add_definitions(-DSPUSING_DLL)

	set_target_properties(sphost PROPERTIES 
		VERSION "${SPHOST_MAJOR_VERSION}.${SPHOST_RELEASE_VERSION}.${SPHOST_EPOCH_VERSION}"
		SOVERSION ${SPHOST_MAJOR_VERSION}
	)
	
	INSTALL (TARGETS sphost RUNTIME DESTINATION ${LIBRUNTIMEDIR} LIBRARY DESTINATION ${LIBDIR})
ENDIF(BUILD_SHARED_LIBS)
