cmake build: X11 is needed for linking glewinfo and visualinfo

This commit is contained in:
Nigel Stewart 2017-01-08 11:13:00 +10:00
parent a9eb02921c
commit 29a4848d0d

View File

@ -37,6 +37,10 @@ else ()
endif () endif ()
find_package (OpenGL REQUIRED) find_package (OpenGL REQUIRED)
#X11 is only required when builing utils/
if(BUILD_UTILS)
find_package (X11)
endif()
set (GLEW_LIBRARIES ${OPENGL_LIBRARIES}) set (GLEW_LIBRARIES ${OPENGL_LIBRARIES})
add_definitions (-DGLEW_NO_GLU) add_definitions (-DGLEW_NO_GLU)
@ -88,9 +92,15 @@ install ( TARGETS ${targets_to_install}
if (BUILD_UTILS) if (BUILD_UTILS)
add_executable (glewinfo ${GLEW_DIR}/src/glewinfo.c) add_executable (glewinfo ${GLEW_DIR}/src/glewinfo.c)
target_link_libraries (glewinfo glew) target_link_libraries (glewinfo glew)
if (NOT WIN32)
target_link_libraries(glewinfo ${X11_LIBRARIES})
endif ()
add_executable (visualinfo ${GLEW_DIR}/src/visualinfo.c) add_executable (visualinfo ${GLEW_DIR}/src/visualinfo.c)
target_link_libraries (visualinfo glew) target_link_libraries (visualinfo glew)
if (NOT WIN32)
target_link_libraries(visualinfo ${X11_LIBRARIES})
endif ()
install ( TARGETS glewinfo visualinfo install ( TARGETS glewinfo visualinfo
DESTINATION bin) DESTINATION bin)