if(NOT LIBPROJECT)
	include(QtWraps)
endif()
set(_SEARCH_DIR)
if(WIN32)
	find_package(MinGW REQUIRED)
	set(_SEARCH_DIR ${MINGW_LIB})
	set(QAD_INCLUDES ${MINGW_INCLUDE}/qad)
else()
	set(_DIR_ "/usr")
	if(APPLE)
		set(_DIR_ "/usr/local")
	endif()
	set(_SEARCH_DIR ${_DIR_}/lib/)
	set(QAD_INCLUDES ${_DIR_}/include/qad)
endif()
set(_QAD_LIBS utils widgets application blockview graphic sql_table touch_widgets)
if(LIBPROJECT)
	set(QAD_INCLUDES)
endif()
foreach(_Q ${_QAD_LIBS})
	string(TOUPPER ${_Q} _QU)
	if(LIBPROJECT)
		set(QAD_${_QU}_LIBRARY qad_${_Q})
		list(APPEND QAD_INCLUDES ${QAD_DIR}/${_Q})
	else()
		foreach(_v ${_QT_VERSIONS_})
			find_library(QAD${_v}_${_QU}_LIBRARY qad_${_Q}${_v} ${_SEARCH_DIR})
			set(MULTILIB_${_Q}_SUFFIX_Qt${_v} ${_v})
			set(MULTILIB_${_Q}_SUFFIX_Qt${_v} ${_v} PARENT_SCOPE)
		endforeach()
	endif()
	#message(STATUS "Library ${_Q} (${_QU}) -> ${QAD_${_QU}_LIBRARY} found in ${_SEARCH_DIR}")
	list(APPEND QT_MULTILIB_LIST qad_${_Q})
endforeach()
set(QT_MULTILIB_LIST ${QT_MULTILIB_LIST} PARENT_SCOPE)
if(NOT LIBPROJECT)
	if (NOT _QAD_MSG)
		set(_QAD_MSG 1 CACHE BOOL "msg_qad" FORCE)
		message(STATUS "Found QAD")
	endif()
endif()
