cmake_minimum_required(VERSION 3.0)
project(qglengine_widgets)
if (POLICY CMP0017)
	cmake_policy(SET CMP0017 NEW)
endif()
find_qt(Qt5 Core Gui Widgets)
qt_sources(SRC)
qt_wrap(${SRC} HDRS out_HDR CPPS out_CPP QMS out_QM)
file(GLOB PHS "*_p.h")
list(REMOVE_ITEM out_HDR "${PHS}")
import_version(${PROJECT_NAME} qglengine)
set_deploy_property(${PROJECT_NAME} SHARED
	LABEL "QGLEngine widgets library"
	FULLNAME "${_DOMAIN}.${PROJECT_NAME}"
	COMPANY "${_COMPANY}"
	INFO "QGLEngine widgets library")
make_rc(${PROJECT_NAME} _RC)
qt_add_library(${PROJECT_NAME} SHARED out_CPP ${_RC})
qt_target_link_libraries(${PROJECT_NAME} qad_utils qad_widgets qglengine_core)
qt_target_include_directories(${PROJECT_NAME} PRIVATE ${QAD_INCLUDES} "${CMAKE_CURRENT_SOURCE_DIR}/../" "${CMAKE_CURRENT_SOURCE_DIR}/../core")
list(APPEND QT_MULTILIB_LIST ${PROJECT_NAME})
set(QT_MULTILIB_LIST ${QT_MULTILIB_LIST} PARENT_SCOPE)
#message(STATUS "Building ${PROJECT_NAME}")
if (LIBPROJECT)
	sdk_install("qglengine" "${PROJECT_NAME}" "${out_HDR}" "${out_QM}")
else()
	if (LIB)
		if (WIN32)
			qt_install(FILES ${out_HDR} DESTINATION ${MINGW_INCLUDE}/qglengine)
			qt_install(TARGETS ${PROJECT_NAME} DESTINATION ${MINGW_LIB})
			qt_install(TARGETS ${PROJECT_NAME} RUNTIME DESTINATION ${MINGW_BIN})
			qt_install(TARGETS ${PROJECT_NAME} RUNTIME DESTINATION QtBin)
		else()
			qt_install(FILES ${out_HDR} DESTINATION ${CMAKE_INSTALL_PREFIX}/include/qglengine)
			qt_install(TARGETS ${PROJECT_NAME} DESTINATION ${CMAKE_INSTALL_PREFIX}/lib)
		endif()
		message(STATUS "Install ${PROJECT_NAME} to system \"${CMAKE_INSTALL_PREFIX}\"")
	else()
		if(WIN32)
			qt_install(TARGETS ${PROJECT_NAME} RUNTIME DESTINATION bin)
			qt_install(TARGETS ${PROJECT_NAME} ARCHIVE DESTINATION lib)
		else()
			qt_install(TARGETS ${PROJECT_NAME} DESTINATION bin/lib)
		endif()
		qt_install(TARGETS ${PROJECT_NAME} DESTINATION lib)
		qt_install(FILES ${H} DESTINATION include/qglengine)
		message(STATUS "Install ${PROJECT_NAME} to local \"bin\", \"lib\" and \"include\"")
	endif()
endif()
