mirror of
https://github.com/SFML/SFML.git
synced 2024-11-25 04:41:05 +08:00
Fix CMP0072 CMake warning - also allow user to set OpenGL_GL_PREFERENCE
This commit is contained in:
parent
21c6c64ecd
commit
254a470346
@ -235,6 +235,13 @@ if(SFML_OS_LINUX OR SFML_OS_FREEBSD OR SFML_OPENBSD)
|
||||
target_link_libraries(sfml-window PRIVATE X11)
|
||||
endif()
|
||||
|
||||
# CMake 3.11 and later prefer to choose GLVND, but we choose legacy OpenGL for backward compability
|
||||
# (unless the OpenGL_GL_PREFERENCE was explicitly set)
|
||||
# See CMP0072 for more details (cmake --help-policy CMP0072)
|
||||
if ((NOT ${CMAKE_VERSION} VERSION_LESS 3.11) AND (NOT OpenGL_GL_PREFERENCE))
|
||||
set(OpenGL_GL_PREFERENCE "LEGACY")
|
||||
endif()
|
||||
|
||||
if(SFML_OPENGL_ES)
|
||||
if(SFML_OS_IOS)
|
||||
target_link_libraries(sfml-window PRIVATE "-framework OpenGLES")
|
||||
@ -242,7 +249,7 @@ if(SFML_OPENGL_ES)
|
||||
target_link_libraries(sfml-window PRIVATE EGL GLESv1_CM)
|
||||
endif()
|
||||
else()
|
||||
sfml_find_package(OpenGL INCLUDE "OPENGL_INCLUDE_DIR" LINK "OPENGL_gl_LIBRARY")
|
||||
sfml_find_package(OpenGL INCLUDE "OPENGL_INCLUDE_DIR" LINK "OPENGL_LIBRARIES")
|
||||
target_link_libraries(sfml-window PRIVATE OpenGL)
|
||||
endif()
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user