Browse Source

Fix link error when linking against VTK build with KITS enabled.

This commit fixes the error report below happening when building
against VTK configured with option VTK_ENABLE_KITS enabled.

The explicit list of VTK libraries has been originally added in
4c54ae0 (Make VTK6 linking more robust) to fix issue when building
CTK on Debian (see Debian bug #747436)

8<---8<---8<---8<---8<---8<---
[...]
Linking CXX shared library ../../../../bin/libCTKVisualizationVTKCore.so
/usr/bin/ld: cannot find -lvtkRenderingFreeTypeOpenGL
collect2: error: ld returned 1 exit status
[...]
8<---8<---8<---8<---8<---8<---
Jean-Christophe Fillion-Robin 9 years ago
parent
commit
4deb7db0c8
1 changed files with 6 additions and 2 deletions
  1. 6 2
      Libs/Visualization/VTK/Core/CMakeLists.txt

+ 6 - 2
Libs/Visualization/VTK/Core/CMakeLists.txt

@@ -72,9 +72,13 @@ if(${VTK_VERSION_MAJOR} GREATER 5)
     vtkInteractionStyle
     vtkRenderingAnnotation
     vtkRenderingCore
-    vtkRenderingFreeType${VTK_RENDERING_BACKEND}
-    vtkRendering${VTK_RENDERING_BACKEND}
     )
+  if(TARGET vtkRenderingFreeType${VTK_RENDERING_BACKEND})
+    list(APPEND VTK_LIBRARIES vtkRenderingFreeType${VTK_RENDERING_BACKEND})
+  endif()
+  if(TARGET vtkRendering${VTK_RENDERING_BACKEND})
+    list(APPEND VTK_LIBRARIES vtkRendering${VTK_RENDERING_BACKEND})
+  endif()
   if(TARGET vtkIOMPIImage)
     list(APPEND VTK_LIBRARIES vtkIOMPIImage )
   endif()