# ITK
FIND_PACKAGE(ITK REQUIRED)
IF(ITK_FOUND)
	INCLUDE_DIRECTORIES(${ITK_INCLUDE_DIRS})
	INCLUDE(${ITK_USE_FILE})
ELSE()
	MESSAGE(FATAL_ERROR "ITK not found, but needed.")
ENDIF(ITK_FOUND)


# The headers and sources in the ritkCommon module
#=================================================
SET(HDRS
	ritkCommon.h
	ritkGenericPayloadContainer.h
	ritkImagePayloadContainer.h
	ritkCameraParameters.h
	ritkRImage.h
	ritkRGBRImage.h
	ritkRImageSource.h
	ritkRImageFileSource.h
	ritkRImageFileWriter.h
	ritkRImageFilterWrapper.h
	ritkRImageIOManager.h
	ritkRImageIOBase.h
	ritkRImageIO.h
	ritkRGBRImageIO.h
	ritkRangeImageToWorldCoordImageFilter.h
	ritkGenericImportImageContainer.h
	ritkRGBMappingImageFilter.h
)

SET(SRCS
	ritkGenericPayloadContainer.cxx
	ritkImagePayloadContainer.txx
	ritkCameraParameters.cxx
	ritkRImage.txx
	ritkRGBRImage.txx
	ritkRImageSource.txx
	ritkRImageFileSource.txx
	ritkRImageFileWriter.txx
	ritkRImageFilterWrapper.txx	
	ritkRImageIOManager.txx
	ritkRImageIOBase.txx
	ritkRImageIO.txx
	ritkRGBRImageIO.txx
	ritkRangeImageToWorldCoordImageFilter.txx
	ritkGenericImportImageContainer.txx
	ritkCommonInstantiations.cxx
	ritkRGBMappingImageFilter.txx
)


# Set the library name for the ritkCommon module
# ==============================================
SET(COMMON_LIBRARY ritkCommon CACHE INTERNAL "")
SET(LIBRARY_OUTPUT_PATH "${CMAKE_BINARY_DIR}")
SET(CMAKE_INSTALL_RPATH_USE_LINK_PATH TRUE)


# Project settings
# ================
SET(COMMON_INCLUDE_DIRS ${CMAKE_CURRENT_SOURCE_DIR} ${TOOLS_INCLUDE_DIRS} CACHE INTERNAL "")
INCLUDE_DIRECTORIES(${COMMON_INCLUDE_DIRS})
ADD_DEFINITIONS("/DCOMMON_SHAREDLIB_EXPORT")
ADD_LIBRARY(${COMMON_LIBRARY} SHARED ${SRCS} ${HDRS} ${ITK_SRCS} ${ITK_HDRS}) 
TARGET_LINK_LIBRARIES(${COMMON_LIBRARY} ${TOOLS_LIBRARY} ${ITK_LIBRARIES})
SET_TARGET_PROPERTIES(${COMMON_LIBRARY} PROPERTIES DEBUG_POSTFIX "d")

# Module installation
# ====================
INSTALL(FILES 	${HDRS} DESTINATION dev/include/Common)
INSTALL(TARGETS ${COMMON_LIBRARY} CONFIGURATIONS Debug
	RUNTIME DESTINATION bin/debug
	LIBRARY DESTINATION dev/lib/debug
	ARCHIVE DESTINATION dev/lib/debug
)
INSTALL(TARGETS ${COMMON_LIBRARY} CONFIGURATIONS Release
	RUNTIME DESTINATION bin/release
	LIBRARY DESTINATION dev/lib/release
	ARCHIVE DESTINATION dev/lib/release
)
