[vtk-developers] Errors in building VTKExamples in today's CVS

Brad King brad.king at kitware.com
Mon Dec 21 10:46:15 EST 2009


Bill Lorensen wrote:
> In my local build I have modified the Examples/Foo/Cxx files to do this:
> 
> IF(NOT VTK_BINARY_DIR)
> FIND_PACKAGE(VTK REQUIRED)
> ENDIF(NOT VTK_BINARY_DIR)
> 
> This seems to let me build outside of the VTK tree. Doesn't this
> simple approach work OK?

As long as there is a test that builds the whole examples tree, or
perhaps a test for each individual example, as an outside project.
Otherwise examples will stop working outside the tree.

> Also, since one can build with examples off, the solution can be kept
> small if one desires it to be small.

Another advantage of the separate solution for VTKExamples is that
after building VTK one could go load that solution to edit-and-build
the examples by themselves.  Since the custom-target approach was
implemented, CMake has gained a new feature that allows this use case
without using the custom target.

At the top of the VTK/Examples/CMakeLists.txt file, add the command

  project(VTKExamples)

if it is not there already.  CMake now converts all project() calls
into a VS solution that has just the subproject and its dependencies.
If you add a

  project(MyExample)

in each test project, there will be a solution for each example with
all its dependencies but no other examples.

> BTW, for the tests themselves I am using the vtk test framework, so
> that only one executable per kit is generated for testing. That works
> great.

Great.

-Brad



More information about the vtk-developers mailing list