if(NOT CMAKE_BUILD_TYPE)
	message(FATAL_ERROR "Need to set CMAKE_BUILD_TYPE for further generation")
endif()

# Set library path
if(APPLE)
	set(OS "macos")
	set(LIBRARY_PATH "$ENV{COFFEE_ROOT}/angle/lib/${OS}/${CMAKE_BUILD_TYPE}")
elseif(UNIX AND NOT APPLE)
	if("${CMAKE_SYSTEM_PROCESSOR}" MATCHES ".*[xX]86.*")
		# x86: Add angle library path
		set(OS "linux")
		set(ARCH ${CMAKE_SYSTEM_PROCESSOR})
		set(LIBRARY_PATH "$ENV{COFFEE_ROOT}/angle/lib/${OS}_${ARCH}/${CMAKE_BUILD_TYPE}")
	endif()
elseif(MSVC)
	set(OS "windows")
	if(CMAKE_SIZEOF_VOID_P EQUAL 8)
		set(SIZE "64")
	elseif(CMAKE_SIZEOF_VOID_P EQUAL 4)
		gset(SIZE "32")
	else()
		set(SIZE "unknown")
	endif()
	set(LIBRARY_PATH "$ENV{COFFEE_ROOT}/angle/lib/${OS}_${SIZE}/${CMAKE_BUILD_TYPE}")
else()
	set(OS "unknown")
	set(LIBRARY_PATH "$ENV{COFFEE_ROOT}/angle/lib/${OS}/${CMAKE_BUILD_TYPE}")
endif()
# Set LIBRARY_PATH
if("${LIBRARY_PATH}" MATCHES ".*angle.*")
	message(STATUS "Set common link directories : ${LIBRARY_PATH}")
	link_directories(${LIBRARY_PATH})
endif()
