From c9f4c016c7bcb4d994d867f0a340aaaa01b93ddc Mon Sep 17 00:00:00 2001
From: Alexey Pavlov <alexpux@gmail.com>
Date: Thu, 2 Feb 2017 10:01:02 +0300
Subject: [PATCH 6/6] ILUT need opengl and glut for linking

---
 DevIL/src-ILUT/CMakeLists.txt | 20 ++++++++++++++++++++
 1 file changed, 20 insertions(+)

diff --git a/DevIL/src-ILUT/CMakeLists.txt b/DevIL/src-ILUT/CMakeLists.txt
index a2926bec..63662bc6 100644
--- a/DevIL/src-ILUT/CMakeLists.txt
+++ b/DevIL/src-ILUT/CMakeLists.txt
@@ -20,6 +20,24 @@ endif( CMAKE_SIZEOF_VOID_P EQUAL 8 )
 
 include_directories( include ../include )
 
+# Find glut
+find_package(GLUT REQUIRED)
+include_directories(${GLUT_INCLUDE_DIRS})
+link_directories(${GLUT_LIBRARY_DIRS})
+add_definitions(${GLUT_DEFINITIONS})
+if(NOT GLUT_FOUND)
+    message(ERROR " GLUT not found!")
+endif(NOT GLUT_FOUND)
+
+# Find opengl
+find_package(OpenGL REQUIRED)
+include_directories(${OpenGL_INCLUDE_DIRS})
+link_directories(${OpenGL_LIBRARY_DIRS})
+add_definitions(${OpenGL_DEFINITIONS})
+if(NOT OPENGL_FOUND)
+    message(ERROR " OPENGL not found!")
+endif(NOT OPENGL_FOUND)
+
 # for windows add the .def and .rc files to the source list
 if(WIN32)
 	add_definitions(-DALLEGRO_MSVC)
@@ -52,6 +70,8 @@ set_target_properties(ILUT PROPERTIES SOVERSION 1)
 target_link_libraries(ILUT
 	IL
 	ILU
+	${OPENGL_LIBRARIES}
+	${GLUT_LIBRARY}
 )
 
 # generate pkg-config file
-- 
2.11.0

