cmake_minimum_required(VERSION 2.6)
PROJECT(common)

#make the list with all the source files
FILE(GLOB_RECURSE SOURCES "${CRTMPSERVER_SOURCES_ROOT}/common/src/*.cpp" )

#prepare the include directories
INCLUDE_DIRECTORIES(
	${TINYXML_INCLUDE_PATH}
	${OPENSSL_INCLUDE_PATH}
	${LUA_INCLUDE_PATH}
	${CRTMPSERVER_SOURCES_ROOT}/common/include
)

#create the library
ADD_LIBRARY(${PROJECT_NAME} ${LIB_TYPE} ${SOURCES})
ADD_PRECOMPILED_HEADER(${PROJECT_NAME} "${CRTMPSERVER_SOURCES_ROOT}/common/include/common.h")
IF(${LIB_TYPE} MATCHES "SHARED")
	TARGET_LINK_LIBRARIES(
		${PROJECT_NAME} 
		${LUA_LIBRARY_PATH} 
		${TINYXML_LIBRARY_PATH} 
		${OPENSSL_LIBRARY_PATH} 
		${CRYPTO_LIBRARY_PATH} 
		${Z_LIBRARY_PATH}
	)
	INSTALL(TARGETS ${PROJECT_NAME} LIBRARY DESTINATION ${CRTMPSERVER_ROOT})
ENDIF(${LIB_TYPE} MATCHES "SHARED")

