From 0a61085d48e78bc985b9caf24a96fba459c04e2b Mon Sep 17 00:00:00 2001 From: Kenneth Moreland Date: Fri, 9 Sep 2016 15:01:17 -0600 Subject: [PATCH] Do not load OpenGL libraries if OSMesa already loaded OSMesa should have its own version of OpenGL, and another OpenGL library could conflict with it. --- CMake/VTKmConfigureComponents.cmake | 19 +++++++++++++------ 1 file changed, 13 insertions(+), 6 deletions(-) diff --git a/CMake/VTKmConfigureComponents.cmake b/CMake/VTKmConfigureComponents.cmake index 6c4a081df..26dce7d31 100644 --- a/CMake/VTKmConfigureComponents.cmake +++ b/CMake/VTKmConfigureComponents.cmake @@ -130,13 +130,20 @@ macro(vtkm_configure_component_OpenGL) # succeed even if the OSMesa configuration fails. vtkm_configure_component_OSMesa() - find_package(OpenGL ${VTKm_FIND_PACKAGE_QUIETLY}) + if(NOT VTKm_OSMesa_FOUND) + find_package(OpenGL ${VTKm_FIND_PACKAGE_QUIETLY}) - vtkm_finish_configure_component(OpenGL - DEPENDENT_VARIABLES VTKm_Base_FOUND OPENGL_FOUND - ADD_INCLUDES ${OPENGL_INCLUDE_DIR} - ADD_LIBRARIES ${OPENGL_LIBRARIES} - ) + vtkm_finish_configure_component(OpenGL + DEPENDENT_VARIABLES VTKm_Base_FOUND OPENGL_FOUND + ADD_INCLUDES ${OPENGL_INCLUDE_DIR} + ADD_LIBRARIES ${OPENGL_LIBRARIES} + ) + else() + # OSMesa comes with its own implementation of OpenGL. So if OSMesa has been + # found, then simply report that OpenGL has been found and use the includes + # and libraries already added for OSMesa. + set(VTKm_OpenGL_FOUND TRUE) + endif() endmacro(vtkm_configure_component_OpenGL) macro(vtkm_configure_component_OSMesa)