The build system does not seem to consistently respect non-default options. Fix that in the patch. The following forces X11 on Apple and fixes linking. --- CMakeLists.txt 2023-11-14 07:37:21.000000000 +0800 +++ CMakeLists.txt 2024-05-28 23:18:57.000000000 +0800 @@ -11,6 +11,8 @@ if (APPLE) include(vtkApple) + set(VTK_USE_COCOA OFF FORCE) + set(VTK_USE_X ON FORCE) endif () # must be before the following iOS / Android --- Rendering/OpenGL2/CMakeLists.txt 2023-11-14 07:37:21.000000000 +0800 +++ Rendering/OpenGL2/CMakeLists.txt 2024-05-28 23:22:46.000000000 +0800 @@ -316,7 +316,7 @@ OVERRIDE vtkEGLRenderWindow) set(has_vtkRenderWindow_override 1) include_directories("${CMAKE_ANDROID_NDK}/sources/android/native_app_glue") -elseif (EMSCRIPTEN) +elseif (VTK_USE_SDL2) # Add some custom overrides vtk_object_factory_declare( BASE vtkRenderWindow @@ -402,6 +402,7 @@ if (VTK_USE_X) vtk_module_find_package(PACKAGE X11) vtk_module_link(VTK::RenderingOpenGL2 PUBLIC X11::X11) + vtk_module_link(VTK::RenderingOpenGL2 PUBLIC GL) if (TARGET X11::Xcursor) vtk_module_link(VTK::RenderingOpenGL2 PRIVATE X11::Xcursor) else() --- CMake/vtkOpenGLOptions.cmake 2023-11-14 07:37:21.000000000 +0800 +++ CMake/vtkOpenGLOptions.cmake 2024-05-28 23:20:32.000000000 +0800 @@ -8,12 +8,12 @@ include(CMakeDependentOption) # For each platform specific API, we define VTK_USE_ options. -cmake_dependent_option(VTK_USE_COCOA "Use Cocoa for VTK render windows" ON - "APPLE;NOT APPLE_IOS" OFF) +set(default_use_cocoa OFF) +option(VTK_USE_COCOA "Use Cocoa for VTK render windows" "${default_use_cocoa}") mark_as_advanced(VTK_USE_COCOA) set(default_use_x OFF) -if(UNIX AND NOT ANDROID AND NOT APPLE AND NOT APPLE_IOS AND NOT CMAKE_SYSTEM_NAME STREQUAL "Emscripten") +if(UNIX AND NOT ANDROID AND NOT APPLE_IOS AND NOT CMAKE_SYSTEM_NAME STREQUAL "Emscripten") set(default_use_x ON) endif() option(VTK_USE_X "Use X for VTK render windows" "${default_use_x}")