summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorClaudio Fantacci <claudio.fantacci@gmail.com>2019-08-06 10:57:50 (GMT)
committerBrad King <brad.king@kitware.com>2019-08-06 13:49:03 (GMT)
commitab822a9b48d43ffec3cc775eb8c8028ac4a96d2e (patch)
treeee5ec8d7f6568e253401d11befc31bc6ee3206a9
parenta8a3efa3be3ec6162495abc0ec0d6721a9fcdf5e (diff)
downloadCMake-ab822a9b48d43ffec3cc775eb8c8028ac4a96d2e.zip
CMake-ab822a9b48d43ffec3cc775eb8c8028ac4a96d2e.tar.gz
CMake-ab822a9b48d43ffec3cc775eb8c8028ac4a96d2e.tar.bz2
FindGLEW: Add required OpenGL dependency in macOS
macOS requires OpenGL as INTERFACE_LINK_LIBRARIES dependency in the GLEW targets. This commit fixes this issue.
-rw-r--r--Modules/FindGLEW.cmake31
1 files changed, 31 insertions, 0 deletions
diff --git a/Modules/FindGLEW.cmake b/Modules/FindGLEW.cmake
index 18320b4..0c4dc80 100644
--- a/Modules/FindGLEW.cmake
+++ b/Modules/FindGLEW.cmake
@@ -70,6 +70,22 @@ if(GLEW_VERBOSE)
message(STATUS "FindGLEW: did not find GLEW CMake config file. Searching for libraries.")
endif()
+if(APPLE)
+ find_package(OpenGL QUIET)
+
+ if(OpenGL_FOUND)
+ if(GLEW_VERBOSE)
+ message(STATUS "FindGLEW: Found OpenGL Framework.")
+ message(STATUS "FindGLEW: OPENGL_LIBRARIES: ${OPENGL_LIBRARIES}")
+ endif()
+ else()
+ if(GLEW_VERBOSE)
+ message(STATUS "FindGLEW: could not find GLEW library.")
+ endif()
+ return()
+ endif()
+endif()
+
function(__glew_set_find_library_suffix shared_or_static)
if((UNIX AND NOT APPLE) AND "${shared_or_static}" MATCHES "SHARED")
@@ -210,6 +226,11 @@ if(NOT TARGET GLEW::glew AND NOT GLEW_USE_STATIC_LIBS)
set_target_properties(GLEW::glew
PROPERTIES INTERFACE_INCLUDE_DIRECTORIES "${GLEW_INCLUDE_DIRS}")
+ if(APPLE)
+ set_target_properties(GLEW::glew
+ PROPERTIES INTERFACE_LINK_LIBRARIES OpenGL::GL)
+ endif()
+
if(GLEW_SHARED_LIBRARY_RELEASE)
set_property(TARGET GLEW::glew
APPEND
@@ -238,6 +259,11 @@ elseif(NOT TARGET GLEW::glew_s AND GLEW_USE_STATIC_LIBS)
set_target_properties(GLEW::glew_s
PROPERTIES INTERFACE_INCLUDE_DIRECTORIES "${GLEW_INCLUDE_DIRS}")
+ if(APPLE)
+ set_target_properties(GLEW::glew_s
+ PROPERTIES INTERFACE_LINK_LIBRARIES OpenGL::GL)
+ endif()
+
if(GLEW_STATIC_LIBRARY_RELEASE)
set_property(TARGET GLEW::glew_s
APPEND
@@ -267,6 +293,11 @@ if(NOT TARGET GLEW::GLEW)
set_target_properties(GLEW::GLEW
PROPERTIES INTERFACE_INCLUDE_DIRECTORIES "${GLEW_INCLUDE_DIRS}")
+ if(APPLE)
+ set_target_properties(GLEW::GLEW
+ PROPERTIES INTERFACE_LINK_LIBRARIES OpenGL::GL)
+ endif()
+
if(TARGET GLEW::glew)
if(GLEW_SHARED_LIBRARY_RELEASE)
set_property(TARGET GLEW::GLEW