For cmake 3.4 - link X11 libs for glewinfo and visualinfo unless not available, or GLEW_OSMESA mode.

This commit is contained in:
Nigel Stewart 2016-01-08 23:25:46 +10:00
parent 5811916f32
commit 9297c604ca

View File

@ -39,6 +39,8 @@ else ()
endif () endif ()
find_package (OpenGL REQUIRED) find_package (OpenGL REQUIRED)
find_package (X11)
set (GLEW_LIBRARIES ${OPENGL_LIBRARIES}) set (GLEW_LIBRARIES ${OPENGL_LIBRARIES})
add_definitions (-DGLEW_NO_GLU) add_definitions (-DGLEW_NO_GLU)
@ -65,6 +67,7 @@ if (GLEW_OSMESA)
endif () endif ()
add_definitions (-DGLEW_OSMESA) add_definitions (-DGLEW_OSMESA)
set (GLEW_LIBRARIES ${OSMESA_LIB_NAME} ${OPENGL_LIBRARIES}) set (GLEW_LIBRARIES ${OSMESA_LIB_NAME} ${OPENGL_LIBRARIES})
set (X11_LIBRARIES)
endif () endif ()
#### GLEW #### #### GLEW ####
@ -116,14 +119,14 @@ if (BUILD_UTILS)
list (APPEND GLEWINFO_SRC_FILES ${GLEW_DIR}/build/glewinfo.rc) list (APPEND GLEWINFO_SRC_FILES ${GLEW_DIR}/build/glewinfo.rc)
endif () endif ()
add_executable (glewinfo ${GLEWINFO_SRC_FILES}) add_executable (glewinfo ${GLEWINFO_SRC_FILES})
target_link_libraries (glewinfo glew) target_link_libraries (glewinfo glew ${X11_LIBRARIES})
set (VISUALINFO_SRC_FILES ${GLEW_DIR}/src/visualinfo.c) set (VISUALINFO_SRC_FILES ${GLEW_DIR}/src/visualinfo.c)
if (WIN32) if (WIN32)
list (APPEND VISUALINFO_SRC_FILES ${GLEW_DIR}/build/visualinfo.rc) list (APPEND VISUALINFO_SRC_FILES ${GLEW_DIR}/build/visualinfo.rc)
endif () endif ()
add_executable (visualinfo ${VISUALINFO_SRC_FILES}) add_executable (visualinfo ${VISUALINFO_SRC_FILES})
target_link_libraries (visualinfo glew) target_link_libraries (visualinfo glew ${X11_LIBRARIES})
install ( TARGETS glewinfo visualinfo install ( TARGETS glewinfo visualinfo
DESTINATION bin) DESTINATION bin)