[ITK-dev] ITK changes VTK_LIBRARIES?

Jian Cheng jian.cheng.1983 at gmail.com
Thu Mar 12 17:44:14 EDT 2015


Hi,

The the recent release of ITK may changes VTK_LIBRARIES, when I build
ITK with VTK, i.e. set on Module_ITKVtkGlue or Module_WikiExamples.
Please see the attached toy example, and check if the issue can be
reproduced on your side. Thanks.
I am using ITK 4.7.1, VTK 6.1.0, cmake 2.8.12.2.
If I build ITK with VTK, VTK_LIBRARIES will be changed to 
VTK_LIBRARIES=vtkCommonCore;vtksys , even if I find ITK first before I
find VTK.
If I build ITK without VTK, everything is fine.
A workaround is to find VTK first, then copy VTK_LIBRARIES to a
variable, then find ITK and copy VTK_LIBRARIES back.

best,
Jian Cheng
-------------- next part --------------
project( itkEigenSolverTraits )

cmake_minimum_required( VERSION 2.8 )

find_package( VTK REQUIRED )
include( ${VTK_USE_FILE} )
set(VTK_LIBRARIES_back ${VTK_LIBRARIES})

message("VTK_LIBRARIES=${VTK_LIBRARIES}")

find_package( ITK REQUIRED )
include( ${ITK_USE_FILE} )


# set(VTK_LIBRARIES ${VTK_LIBRARIES_back})

message("VTK_LIBRARIES=${VTK_LIBRARIES}")
message("ITK_LIBRARIES=${ITK_LIBRARIES}")


add_executable(main main.cxx)  
target_link_libraries(main ${ITK_LIBRARIES} ${VTK_LIBRARIES})
-------------- next part --------------

#include "itkImage.h"
  
int 
main (int argc, char const* argv[])
{
  typedef itk::Image<double,3> ImageType;
  ImageType::Pointer image = ImageType::New();
  return 0;
}



More information about the Insight-developers mailing list