summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorBrad King <brad.king@kitware.com>2019-08-07 13:57:33 (GMT)
committerKitware Robot <kwrobot@kitware.com>2019-08-07 13:58:56 (GMT)
commit26f0f8bfca2e11a14bd8bcb9f82c505aeff40721 (patch)
tree4628fbe5fda77e01d7ab0b2f397aedc35ce4b387
parentce14f6c67724fccc25547db62e645ab8d115841c (diff)
parentfeeb0381bcd73dfffd3ccf4f57d78caf518528ff (diff)
downloadCMake-26f0f8bfca2e11a14bd8bcb9f82c505aeff40721.zip
CMake-26f0f8bfca2e11a14bd8bcb9f82c505aeff40721.tar.gz
CMake-26f0f8bfca2e11a14bd8bcb9f82c505aeff40721.tar.bz2
Merge topic 'FindGLEW-macOS'
feeb0381bc FindGLEW: Fix typo in verbose log message ab822a9b48 FindGLEW: Add required OpenGL dependency in macOS a8a3efa3be FindGLEW: Fix macOS library suffix selection Acked-by: Kitware Robot <kwrobot@kitware.com> Merge-request: !3656
-rw-r--r--Modules/FindGLEW.cmake37
1 files changed, 34 insertions, 3 deletions
diff --git a/Modules/FindGLEW.cmake b/Modules/FindGLEW.cmake
index 2e9a052..bd69819 100644
--- a/Modules/FindGLEW.cmake
+++ b/Modules/FindGLEW.cmake
@@ -70,11 +70,27 @@ 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 "${shared_or_static}" MATCHES "SHARED")
+ if((UNIX AND NOT APPLE) AND "${shared_or_static}" MATCHES "SHARED")
set(CMAKE_FIND_LIBRARY_SUFFIXES ".so" PARENT_SCOPE)
- elseif(UNIX AND "${shared_or_static}" MATCHES "STATIC")
+ elseif((UNIX AND NOT APPLE) AND "${shared_or_static}" MATCHES "STATIC")
set(CMAKE_FIND_LIBRARY_SUFFIXES ".a" PARENT_SCOPE)
elseif(APPLE AND "${shared_or_static}" MATCHES "SHARED")
set(CMAKE_FIND_LIBRARY_SUFFIXES ".dylib;.so" PARENT_SCOPE)
@@ -194,7 +210,7 @@ find_package_handle_standard_args(GLEW
if(NOT GLEW_FOUND)
if(GLEW_VERBOSE)
- message(STATUS "FindGLEW: could not found GLEW library.")
+ message(STATUS "FindGLEW: could not find GLEW library.")
endif()
return()
endif()
@@ -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