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

Bill Lorensen bill.lorensen at gmail.com
Mon Dec 21 10:27:35 EST 2009


Brad,

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?

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

Bill

On Mon, Dec 21, 2009 at 9:49 AM, Brad King <brad.king at kitware.com> wrote:
> Dave Partyka wrote:
>> Bill Lorensen wrote:
>>> I'm revamping the Examples tree. As part of that I hope to remove the
>>> complexity of the current CMakeLists.txt file. I'm not sure why there
>>> is a need for the custom command to build the examples. The current
>>> method makes it very difficult to add tests to the examples.
>> I think the intention there was so that you could build the examples
>> against an installed vtk, though I guess that doesn't make sense as we
>> no longer ship libraries, just vtk.exe? I am CC'ing Brad King and Dave
>> Cole  as I remember one of them describing this to me a while back. I
>> agree though, that whole CMakeLists.txt is probably more complex than
>> necessary.
>
> There are multiple reasons for the current approach:
>
> (1) The Examples directory has many executables, which if included in
>    the main VTK build crowd VS solution files.
>
> (2) The Examples tree, along with each individual example, should build
>    as a stand-alone project against the build or install tree.
>
> (3) Since the Examples tree must always support building as an outside
>    project, it is best to keep this well-tested by *always* building
>    it that way.
>
> As to the current implementation that meets the above requirements:
>
> (a) The only way to build the Examples tree as an outside project but
>    also build it as part of VTK is to drive the outside project with
>    a custom target.
>
> (b) The current complexity in the Examples/CMakeLists.txt file is left
>    from old versions of CMake whose language was much weaker.
>
> Implementation choice (b) is easy to change.  We can fix it by making
> VTK/Examples a totally standalone directory that CMake never enters as
> a subdirectory of the main build.  The custom target that drive it now
> can be moved to a separate directory.
>
> Implementation choice (a) is not something we can change.  Before it
> was done this way we had constant problems with users that were unable
> to build projects they copied from the examples because they could only
> build in-tree.
>
> Bill, what you seem to want is a new requirement:
>
> (4) The Examples tree should have tests that run as part of the main
>    VTK test suite.
>
> Since there is no add_subdirectory() in the main VTK that enters the
> real Examples build tree, CTestTestfile.cmake does not include the
> Examples tests.  There are two approaches to solving this problem.
>
> (c1) Add a test in the main VTK tree that invokes CTest to run all
>     tests from the Examples tree.
>
> (c2) Use the TEST_INCLUDE_FILE property to include the VTK Examples
>     test suite in the main VTK test suite:
>     http://www.cmake.org/cmake/help/cmake2.6docs.html#prop_dir:TEST_INCLUDE_FILE
>
> I also have some ideas for more complicated solutions but let's not
> discuss them if (c1) or (c2) is acceptable.
>
> -Brad
>



More information about the vtk-developers mailing list