cmake_minimum_required(VERSION 2.6)

# RITK
FIND_PACKAGE(RITK REQUIRED)
IF(RITK_FOUND)
	INCLUDE_DIRECTORIES(${RITK_INCLUDE_DIRS})
	INCLUDE(${RITK_USE_FILE})
ELSE()
	MESSAGE("RITK not found, but needed.")
ENDIF(RITK_FOUND)

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

# QT4
FIND_PACKAGE(Qt4 REQUIRED)
IF(QT4_FOUND)
	INCLUDE_DIRECTORIES(${QT_INCLUDE_DIRS})
	INCLUDE(${QT_USE_FILE})
ELSE()
	MESSAGE("QT4 not found, but needed.")
ENDIF(QT4_FOUND)



# The headers, sources and Qt related stuff in this plugin
# ========================================================
SET(QuadVisualization_HDRS
	QuadVisualizationPluginFactory.h
	QuadVisualizationPlugin.h
	QuadVisualizationWidget.h
)

SET(QuadVisualization_SRCS
	QuadVisualizationPluginFactory.cxx
	QuadVisualizationPlugin.cxx
	QuadVisualizationWidget.cxx
)

SET(QuadVisualization_MOC_HDRS 	
	QuadVisualizationPluginFactory.h
	QuadVisualizationPlugin.h
	QuadVisualizationWidget.h
)

SET(QuadVisualization_UIS
	QuadVisualizationWidget.ui
)

QT4_WRAP_UI(UI_HDRS ${QuadVisualization_UIS})	
QT4_WRAP_CPP(MOC_SRCS ${QuadVisualization_MOC_HDRS})


# Set the library name for this plugin
# ====================================
SET(QuadVisualization_LIBRARY QuadVisualizationPlugin CACHE INTERNAL "")
SET(LIBRARY_OUTPUT_PATH "${CMAKE_BINARY_DIR}")
SET(CMAKE_INSTALL_RPATH_USE_LINK_PATH TRUE)


# Project settings
# ================
SET(QuadVisualization_INCLUDE_DIRS ${CMAKE_CURRENT_SOURCE_DIR} ${CMAKE_CURRENT_BINARY_DIR} CACHE INTERNAL "")
INCLUDE_DIRECTORIES(${QuadVisualization_INCLUDE_DIRS} ${RITK_INCLUDE_DIRS} ${QT_QTOPENGL_INCLUDE_DIR})
ADD_DEFINITIONS(-DQT_PLUGIN)
ADD_DEFINITIONS(-DQT_SHARED)
ADD_LIBRARY(${QuadVisualization_LIBRARY} SHARED ${QuadVisualization_SRCS} ${QuadVisualization_HDRS} ${MOC_SRCS} ${UI_HDRS})
TARGET_LINK_LIBRARIES(${QuadVisualization_LIBRARY}
	debug ${RITK_COMMON_LIBRARY_DEBUG}
	optimized ${RITK_COMMON_LIBRARY}
	debug ${RITK_CORE_LIBRARY_DEBUG}
	optimized ${RITK_CORE_LIBRARY}
	debug ${RITK_VISUALIZATION_LIBRARY_DEBUG}
	optimized ${RITK_VISUALIZATION_LIBRARY}
	${ITK_LIBRARIES}
	${QT_LIBRARIES}

)
SET_TARGET_PROPERTIES(${QuadVisualization_LIBRARY} PROPERTIES DEBUG_POSTFIX "d")


# Module installation
# ===================
INSTALL(TARGETS ${QuadVisualization_LIBRARY} CONFIGURATIONS RELEASE
	RUNTIME DESTINATION ${RITK_BINARY_DIR}/release/plugins
	LIBRARY DESTINATION ${RITK_BINARY_DIR}/release/plugins
)
INSTALL(TARGETS ${QuadVisualization_LIBRARY} CONFIGURATIONS DEBUG
	RUNTIME DESTINATION ${RITK_BINARY_DIR}/debug/plugins 
	LIBRARY DESTINATION ${RITK_BINARY_DIR}/debug/plugins 
)
