[vtkusers] urgent: including vtk in a makefile

Leue, William M (Research) leue at crd.ge.com
Thu May 29 09:53:54 EDT 2003


I asked the same question a few months ago. I did try to use VTK with an
ordinary makefile, but found only frustration. In fact, you really don't
need much 'cmake' to put together an application with VTK. Here is a
CMakeLists.txt pattern I use for building VTK-based applications that have
C++ main programs. It uses only a tiny part of cmake's capabilities, but
works for me:

SET (HOMEDIR /home/me)
SET (VTKDIR path_to_vtk)

PROJECT(myproject)
ADD_EXECUTABLE ( 
  myproject myproject.cxx
)

INCLUDE DIRECTORIES (
  ${HOMEDIR}/dev_dir
  $(VTKDIR}
  ${VTKDIR}/Common
  ${VTKDIR}/Imaging
  ${VTKDIR}/IO
  ${VTKDIR}/Filtering
  ${VTKDIR}/Graphics
)

LINK_DIRECTORIES (
  ${VTKDIR}/bin
)

TARGET_LINK_LIBRARIES (
  myproject
  vtkCommon
  vtkImaging
  vtkIO
  vtkFiltering
  vtkGraphics
)

With the obvious substitutions for your environment.
So for 'myproject' I decide which VTK components I need to use and add their
include directories and libraries. You can add any other special libraries
you may need to the LINK_DIRECTORIES and TARGET_LINK_LIBRARIES sections. You
should not have to add any of the C++ or C runtimes if you have cmake set up
correctly on your host. Your CMakeLists.txt file can have multiple projects
in the same file: just replicate all the lines from 'PROJECT' to the bottom
and change the project name in the several places it occurs. I use dynamic
libraries, so your mileage may vary if you use static linking. 

I am sure a cmake expert will roll up his eyes at this simple setup, but it
works for me.

-Bill Leue

-----Original Message-----
From: vanessa.noguesruiz at epfl.ch [mailto:vanessa.noguesruiz at epfl.ch]
Sent: Thursday, May 29, 2003 9:34 AM
To: vtkusers at public.kitware.com
Subject: [vtkusers] urgent: including vtk in a makefile


Please please, does anybody know if it's good enough to include a vtk path
(to 
dll's) in a makefile -without using cmake- I've already configured (that 
prepares me my own library files) or if I need the path to the objects 
directories. Then may I include it at the time of linking or compiling my 
files? thanks a lot.
_______________________________________________
This is the private VTK discussion list. 
Please keep messages on-topic. Check the FAQ at:
<http://public.kitware.com/cgi-bin/vtkfaq>
Follow this link to subscribe/unsubscribe:
http://public.kitware.com/mailman/listinfo/vtkusers



More information about the vtkusers mailing list