Target "Pro" links to target "OpenGL::GL" but the target was not found. Perhaps a find_package() call is missing for an IMPORTED target, or an ALIAS target is missing?
If I remove RenderingOpenGL2 from find_package, the cmake is OK. But my project directly return 0 with no window is shown. My code is
@Paulo_Carvalho Thank you for your kindly reply. The reason why I include RenderingOpenGL2 in find_package is that the vtk window don’t show any thing without RenderingOpenGL2.
Include RenderingOpenGL2 in both VTKVisualization/CMakeLists.txt and VTKVisualization/VTKVisualizationTest/CMakeLists.txt, the project can correctly display a line.
Do not include RenderingOpenGL2 in both VTKVisualization/CMakeLists.txt and VTKVisualization/VTKVisualizationTest/CMakeLists.txt, the project directly return 0 with no vtk window is shown.
Remove RendingOpenGL2 in VTKVisualization/CMakeLists.txt, while include RendingOpenGL2 in VTKVisualization/VTKVisualizationTest/CMakeLists.txt, the bug is reported in CMake Generate:
CMake Error at VTKVisualization/VTKVisualizationTest/CMakeLists.txt:7 (add_executable):
Target "VTKVisualizationTest" links to target "OpenGL::GL" but the target
was not found. Perhaps a find_package() call is missing for an IMPORTED
target, or an ALIAS target is missing?
This smells like a FindOpenGL getting the wrong GLVND selection. This should be fixed on master, but you may need to set OpenGL_GL_PREFERENCE to LEGACY manually for older releases.