Skip to content

fix(CMakeLists.txt): fix link errors with vtk libraries

Flavien BRIDAULT requested to merge fix-vtk-link into dev

What does this MR do?

The PCL discovery was done in the main CMakeLists.txt, thus defining VTK compile definitions for all targets. This led to strange link errors, notably in unit-tests, like this one:

fwVtkIOTest/CMakeFiles/fwVtkIOTest.dir/tu/src/ImageTest.cpp.o : Dans la fonction « vtkRenderingCore_AutoInit::vtkRenderingCore_AutoInit() » :
/home/mschweitzer/dev/f4s/deps/install/debug/include/vtk-8.0/vtkRenderingCoreModule.h:44 : référence indéfinie vers « vtkInteractionStyle_AutoInit_Construct() »
fwVtkIOTest/CMakeFiles/fwVtkIOTest.dir/tu/src/ImageTest.cpp.o : Dans la fonction « vtkRenderingCore_AutoInit::~vtkRenderingCore_AutoInit() » :
/home/mschweitzer/dev/f4s/deps/install/debug/include/vtk-8.0/vtkRenderingCoreModule.h:44 : référence indéfinie vers « vtkInteractionStyle_AutoInit_Destruct() »
lib/libfwVtkIO.so.0.1 : référence indéfinie vers « vtkIOExportOpenGL2_AutoInit_Construct() »
lib/libfwVtkIO.so.0.1 : référence indéfinie vers « vtkRenderingContextOpenGL2_AutoInit_Destruct() »
lib/libfwVtkIO.so.0.1 : référence indéfinie vers « vtkRenderingContextOpenGL2_AutoInit_Construct() »
lib/libfwVtkIO.so.0.1 : référence indéfinie vers « vtkIOExportOpenGL2_AutoInit_Destruct() »
collect2: error: ld returned 1 exit status

How to test it?

Rebuild everything.

Additional tests to run

(If you need some specific test e.g Windows compilation...)

  • Build on Windows
  • Build on Linux
  • Build on MacOs
Edited by Flavien BRIDAULT

Merge request reports