[vtk-developers] How to write the CMakeLists.txt file without INCLUDE(${VTK_USE_FILE})

Marcus D. Hanwell marcus.hanwell at kitware.com
Tue Apr 30 09:43:37 EDT 2013


On Tue, Apr 30, 2013 at 9:41 AM, Marcus D. Hanwell
<marcus.hanwell at kitware.com> wrote:
> On Mon, Apr 29, 2013 at 11:38 PM, Mingcheng Chen <linyufly at gmail.com> wrote:
>> Hi everyone,
>>
>> For some reason I do not want INCLUDE(${VTK_USE_FILE}) in my cmake
>> CMakeLists.txt.
>>
>> I use INCLUDE_DIRECTORIES(${VTK_INCLUDE_DIRS}) and target_link_libraries(xxx
>> ${VTK_LIBRARIES}), but it seems not enough.
>>
> I documented this on the VTK 6 migration guide (build system) linked
> from the main VTK wiki page,
>
> http://vtk.org/Wiki/VTK/Build_System_Migration
>
> The missing piece (that can be taken from option 3) is
> set_property(DIRECTORY APPEND PROPERTY COMPILE_DEFINITIONS
> ${VTK_DEFINITIONS}) which will ensure that the object factories are
> initialized. Unfortunately you were not very clear on "but it seems
> not enough" so I am guessing this is the part that was not enough. You
> must also depend on the relevant implementation modules at this time -
> such as vtkRenderingOpenGL.
>
> Hope that helps, including the use file makes things easier but you
> really don't have to do that (we expose all the relevant variables and
> you can inspect the CMake code in the use file if you wish to
> replicate parts that are relevant in your project).
>
If you are worried about CUDA (just read Rob's response) you should be
able to do the compile definitions at the target level -
VTK_DEFINITIONS will be populated with any compiler definitions
necessary for VTK (normal variable, not cached etc).

Marcus



More information about the vtk-developers mailing list