[vtkusers] RE: How to get the Examples to compile in Linux

Leon Chen liming.leon at gmail.com
Mon Jul 11 23:02:02 EDT 2005


Hi,

What you need to do is not write the makefile, just write CMakeLists.
Then you can use Cmake process the CMakeLists.txt, and type 'make',
then the executeable file will be generated. Type the file name to run
the programm.

In linux, you can use 'cmake' to run a command line version cmake.
or 'ccmake' to run a interactive version of it. Acturally it is quite
similar as it in windows.

Here is a 'mini' CMakeLists example
---------------------
PROJECT (Step1)

INCLUDE (${CMAKE_ROOT}/Modules/FindVTK.cmake)
IF (USE_VTK_FILE)
  INCLUDE(${USE_VTK_FILE})
ENDIF (USE_VTK_FILE)

ADD_EXECUTABLE(Cone Cone.cxx)
TARGET_LINK_LIBRARIES(Cone vtkRendering)

----------------------------------

*Step1 is the name of the project, for some IDE, such as msvc
*ADD executable will generate the bin file to run
*TARGET LINK is very important to link the necessary library to the
program. Here is vtkRendering

notice that the cmakelist file should be same both in the windows and
linux.  However, of course... the format of the file path is
different... and so on. I think you can figure it out.


good luck



More information about the vtkusers mailing list