if(NOT OPENCL_PACKAGE_DIR)
	message("ERROR: OPENCL_PACKAGE_DIR requires to be set")
endif(NOT OPENCL_PACKAGE_DIR)

if(MSVC AND NOT CMAKE_CL_64)
	set(BINARY_DIRECTORY "win32")
endif(MSVC AND NOT CMAKE_CL_64)

if(MSVC AND CMAKE_CL_64)
	set(BINARY_DIRECTORY "win64")
endif(MSVC AND CMAKE_CL_64)

if(UNIX)
	set(BINARY_DIRECTORY )
endif(UNIX)

set(OPENCL_INCLUDE_DIR ${OPENCL_PACKAGE_DIR})
set(OPENCL_LIBRARY_DIR ${OPENCL_PACKAGE_DIR}/lib/${BINARY_DIRECTORY})

if(WIN32)
	set(OPENCL_LIBRARY OpenCL)
elseif(UNIX)
	set(OPENCL_LIBRARY OpenCL)
endif(WIN32)

include_directories(${OPENCL_INCLUDE_DIR})
link_directories(${OPENCL_LIBRARY_DIR})

if(OPENCL_LIBRARY AND OPENCL_LIBRARY_DIR AND OPENCL_INCLUDE_DIR)
	set(OPENCL_FOUND "YES")
endif()
