From c1651395d28a3697ab1649f9088490e6c104bd9b Mon Sep 17 00:00:00 2001
From: Guilherme Amadio <amadio@cern.ch>
Date: Thu, 7 Feb 2019 15:54:41 +0100
Subject: [PATCH] graf3d: use imported target for OpenGL

---
 graf3d/eve/CMakeLists.txt  | 8 ++++----
 graf3d/ftgl/CMakeLists.txt | 5 +++--
 graf3d/glew/CMakeLists.txt | 5 +++--
 3 files changed, 10 insertions(+), 8 deletions(-)

diff --git a/graf3d/eve/CMakeLists.txt b/graf3d/eve/CMakeLists.txt
index 877b3960726..ee7c2e970b3 100644
--- a/graf3d/eve/CMakeLists.txt
+++ b/graf3d/eve/CMakeLists.txt
@@ -248,7 +248,8 @@ if(MSVC)
     G__Eve1.cxx
     G__Eve2.cxx
     LIBRARIES
-      ${OPENGL_LIBRARIES}
+      OpenGL::GL
+      OpenGL::GLU
       ${FTGL_LIBRARIES}
       ${GLEW_LIBRARIES}
     DEPENDENCIES
@@ -273,7 +274,8 @@ else()
     SOURCES
       ${EVE_SOURCES}
     LIBRARIES
-      ${OPENGL_LIBRARIES}
+      OpenGL::GL
+      OpenGL::GLU
       ${FTGL_LIBRARIES}
       ${GLEW_LIBRARIES}
     DEPENDENCIES
@@ -285,5 +287,3 @@ else()
       Physics
   )
 endif()
-
-target_include_directories(Eve PUBLIC ${OPENGL_INCLUDE_DIR})
diff --git a/graf3d/ftgl/CMakeLists.txt b/graf3d/ftgl/CMakeLists.txt
index 2872ab87b69..0c5233c4777 100644
--- a/graf3d/ftgl/CMakeLists.txt
+++ b/graf3d/ftgl/CMakeLists.txt
@@ -2,7 +2,7 @@
 # CMakeLists.txt file for building ROOT graf3d/ftgl package
 ############################################################################
 
-include_directories(${OPENGL_INCLUDE_DIR} ${FREETYPE_INCLUDE_DIRS})
+include_directories(${FREETYPE_INCLUDE_DIRS})
 
 if(MACOSX_GLU_DEPRECATED)
   add_definitions(-Wno-deprecated-declarations)
@@ -32,7 +32,8 @@ ROOT_LINKER_LIBRARY(FTGL
     src/FTTextureGlyph.cxx
     src/FTVectoriser.cxx
   LIBRARIES
-    ${OPENGL_LIBRARIES}
+    OpenGL::GL
+    OpenGL::GLU
     ${FREETYPE_LIBRARIES}
     ZLIB::ZLIB
   BUILTINS
diff --git a/graf3d/glew/CMakeLists.txt b/graf3d/glew/CMakeLists.txt
index 367c5bc3aec..765cc72a851 100644
--- a/graf3d/glew/CMakeLists.txt
+++ b/graf3d/glew/CMakeLists.txt
@@ -5,10 +5,11 @@
 ROOT_LINKER_LIBRARY(GLEW
   src/glew.c
   LIBRARIES
-    ${OPENGL_LIBRARIES}
+    OpenGL::GL
+    OpenGL::GLU
 )
 
-target_include_directories(GLEW PUBLIC ${OPENGL_INCLUDE_DIR} PRIVATE inc)
+target_include_directories(GLEW PRIVATE inc)
 
 # Do not install headers for all platforms and configurations.
 if(UNIX)
-- 
GitLab