function(submodule_fill_technology_list)
	if(USE_BOOST)
		set(USE_DEFINITION ${USE_DEFINITION} USE_BOOST)
		set(SUBMODULE_FOLDERS ${SUBMODULE_FOLDERS} boost)	
	endif()
	if(USE_CURL)
		set(USE_DEFINITION ${USE_DEFINITION} USE_CURL)
		set(SUBMODULE_FOLDERS ${SUBMODULE_FOLDERS} curl)	
	endif()
	if(USE_JSONCPP)
		set(USE_DEFINITION ${USE_DEFINITION} USE_JSONCPP)
		set(SUBMODULE_FOLDERS ${SUBMODULE_FOLDERS} jsoncpp)
	endif()
	if(USE_OPENSSL)
		set(USE_DEFINITION ${USE_DEFINITION} USE_OPENSSL)
		set(SUBMODULE_FOLDERS ${SUBMODULE_FOLDERS} openssl)
	endif()
	if(USE_OPENCV)
		set(USE_DEFINITION ${USE_DEFINITION} USE_OPENCV)
		set(SUBMODULE_FOLDERS ${SUBMODULE_FOLDERS} opencv)
	endif()
	if(USE_OCULUS)
		set(USE_DEFINITION ${USE_DEFINITION} USE_OCULUS)
		set(SUBMODULE_FOLDERS ${SUBMODULE_FOLDERS} oculus)	
	endif()
	if(USE_SDL2)
		set(USE_DEFINITION ${USE_DEFINITION} USE_SDL2)
		set(SUBMODULE_FOLDERS ${SUBMODULE_FOLDERS} sdl2)	
	endif()
	if(USE_DIRECTX)
		set(USE_DEFINITION ${USE_DEFINITION} USE_DIRECTX)
		set(SUBMODULE_FOLDERS ${SUBMODULE_FOLDERS} directx)	
	endif()
	set(USE_DEFINITION ${USE_DEFINITION} PARENT_SCOPE)

	set(SUBMODULE_FOLDERS ${SUBMODULE_FOLDERS} PARENT_SCOPE)	
endfunction()

function(submodule_connect_external_projects)
	foreach(SUBMODULE ${SUBMODULE_FOLDERS})
		add_subdirectory(${BLOOD_ROOT}/extern/${SUBMODULE}/ ${BLOOD_ROOT}/assemble/build/intermediate/${SUBMODULE}/)
	endforeach()
	message(STATUS "Connect libraries: ${SUBMODULE_FOLDERS}")
	message(STATUS)
endfunction()

# BLOOD_INCLUDE   // directory for include files
# BLOOD_LIBRARIES // directory for libraries 
function(submodule_set_include_directory)
	if(USE_CURL)
	    set(BLOOD_INCLUDES ${BLOOD_INCLUDES} ${CURL_INCLUDE_DIR})
	endif()
	if(USE_SDL2)
	    set(BLOOD_INCLUDES ${BLOOD_INCLUDES} ${SDL2_INCLUDE_DIR})
	endif()
	if(USE_JSONCPP)
		set(BLOOD_INCLUDES ${BLOOD_INCLUDES} ${JSONCPP_INCLUDE_DIR})
	endif()
	if(USE_OCULUS)
	    set(BLOOD_INCLUDES ${BLOOD_INCLUDES} ${OCULUS_INCLUDE_DIR})
	endif()
	if(USE_OPENSSL)
	    set(BLOOD_INCLUDES ${BLOOD_INCLUDES} ${OPENSSL_INCLUDE_DIR})
	endif()
	if(USE_DIRECTX)
	    set(BLOOD_INCLUDES ${BLOOD_INCLUDES} ${D3DX_INCLUDE_DIR})
	    set(BLOOD_LIBRARIES ${BLOOD_LIBRARIES} ${D3DX_LIBRARIES_DIR})
	endif()
	if(USE_BOOST)
	    set(BLOOD_INCLUDES ${BLOOD_INCLUDES} ${BOOST_INCLUDE_DIRS})
	    set(BLOOD_LIBRARIES ${BOOST_LIBRARIES} ${BOOST_LIBRARIES})
	endif()
	if(USE_OPENCV)
		set(BLOOD_INCLUDES ${BLOOD_INCLUDES} ${OpenCV_SOURCE_DIR}/include/)
		foreach(_module ${OpenCVModules_TARGETS})
			set(_module_path ${${_module}_SOURCE_DIR}/)
			set(BLOOD_INCLUDES ${BLOOD_INCLUDES} ${_module_path}include/)
	        set(BLOOD_LIBRARIES ${BLOOD_INTERMEDIATE}/opencv/lib/)
	        set(BLOOD_LIBRARIES ${BLOOD_INTERMEDIATE}/opencv/3rdparty/)
		endforeach()
	endif()

	set(BLOOD_LIBRARIES ${BLOOD_LIBRARIES} ${BLOOD_ROOT})
	set(BLOOD_INCLUDES  ${BLOOD_INCLUDES}  PARENT_SCOPE)
	set(BLOOD_LIBRARIES ${BLOOD_LIBRARIES} PARENT_SCOPE)
endfunction()

function(submodule_link_dependence)
	if (WIN32)
		target_link_libraries(${project_name} Advapi32 User32)
	endif()
	if(USE_CURL)
	    target_link_libraries(${project_name} libcurl)
	endif()
	if(USE_OCULUS)
	    target_link_libraries(${project_name} oculus)
	endif()
	if(USE_JSONCPP)
		target_link_libraries(${project_name} jsoncpp_lib_static)
	endif()
	if(USE_DIRECTX)
		if(DirectX_9)
			target_link_libraries(${project_name} d3dx9)
		endif()
		if(DirectX_10)
			target_link_libraries(${project_name} d3dx10)
		endif()
		if(DirectX_11)
			target_link_libraries(${project_name} d3dx11)
		endif()
		target_link_libraries(${project_name} User32)
		#d3d11.lib
		#d3dcompiler.lib
		#d3dx11d.lib
		#d3dx9d.lib
		#dxerr.lib
		#dxguid.lib
		#winmm.lib
		#comctl32.lib
	endif()
	if(USE_SDL2)
	    target_link_libraries(${project_name} sdl2)	
	endif()
	if(USE_BOOST)
	    target_link_libraries(${project_name} ${BOOST_LIBRARIES})
	endif()
	if(USE_OPENCV)
	    target_link_libraries(${project_name} IlmImf libjasper libjpeg libpng libtiff libwebp zlib)
	    target_link_libraries(${project_name} comctl32 comdlg32 gdi32 vfw32 user32 oleaut32)
	    target_link_libraries(${project_name} opencv_calib3d opencv_core opencv_features2d opencv_flann opencv_hal
	                                opencv_highgui opencv_imgcodecs opencv_imgproc opencv_ts opencv_shape
	                                opencv_photo opencv_ml opencv_stitching opencv_superres opencv_video
	                                opencv_videoio opencv_videostab opencv_objdetect)
	endif()
	
	if(USE_OPENSSL)
		if(MSVC)
		    set(LIB_TO_LINK
		    	Shell32 Advapi32 ws2_32 wldap32 winmm mswsock
		    	user32 gdi32 imm32 ole32 oleaut32 uuid version)
		    target_link_libraries(${project_name} ${LIB_TO_LINK})
	        target_link_libraries(${project_name} ${OPENSSL_LIBRARIES})
		elseif(UNIX)
	        target_link_libraries(${project_name} crypto)
		    target_link_libraries(${project_name} ${OPENSSL_LIBRARIES})
		endif()
	endif()
endfunction()
