[vtkusers] Using Cmake for VTK + Qt applications on a Mac

Shakes Shekhar.Chandra at sci.monash.edu.au
Thu Mar 13 21:49:57 EDT 2008


Hi Shriram,

I suggest using qmake (Qt's own build tool) for your apps as Qt requires 
moc files and other things while VTK can be linked against like any 
other library. I use a .pro qmake file like the following which u may 
find useful:

TEMPLATE = app
DEPENDPATH += . ../../include
INCLUDEPATH += ../../include

unix:INCLUDEPATH += /usr/include/vtk-5.0 /usr/local/include/vtk-5.0
unix:LIBS += -lvtkRendering -lvtkFiltering -lvtkGraphics 
-lvtkVolumeRendering -lvtkHybrid -lvtkImaging -lvtkIO -lvtkCommon -lQVTK

win32-msvc2005:LIBS += vtkRendering.lib vtkFiltering.lib vtkGraphics.lib 
vtkVolumeRendering.lib vtkHybrid.lib vtkImaging.lib vtkIO.lib 
vtkCommon.lib QVTK.lib
win32-g++:LIBS += -lvtkRendering -lvtkFiltering -lvtkHybrid 
-lvtkGraphics -lvtkVolumeRendering -lvtkImaging -lvtkIO -lvtkCommon -lQVTK

CONFIG += qt warn_on release

#Needed for app to work in Windows
DEFINES    += QT_DLL

# Input
SOURCES += mainvtk.cpp

You may need to add and remove parts depending on what you're doing. 
Hope that helps.

Cheers
Shakes

Shriram Iyer wrote:
> Hi everyone,
>
> I need help with getting cmake to work on a Mac for compiling VTK + Qt 
> applications. I was able to compile Qt 4.3.4 and VTK 5.0.4 without too 
> much trouble. But now, when I try running cmake on my project I get 
> the following error:
>
> -- Loading VTK CMake commands
> CMake Error: Error in cmake code at
> #:7:
> LOAD_COMMAND Attempt to load command failed from file 
> "libcmVTK_WRAP_TCL2.so"
> Current CMake stack:
> [2]    /usr/local/lib/vtk-5.0/UseVTK.cmake
> [1]    /Users/shriram/Development/Endurance/CMakeLists.txt
> CMake Error: Error in cmake code at
> /usr/local/lib/vtk-5.0/UseVTK.cmake:35:
> A command failed during the invocation of macro 
> "VTK_LOAD_SINGLE_CMAKE_EXTENSION".
> CMake Error: Error in cmake code at
> #:27:
> VTK_LOAD_SINGLE_CMAKE_EXTENSION unknown error.
> Current CMake stack:
> [2]    /usr/local/lib/vtk-5.0/UseVTK.cmake
> [1]    /Users/shriram/Development/Endurance/CMakeLists.txt
> CMake Error: Error in cmake code at
> /usr/local/lib/vtk-5.0/UseVTK.cmake:35:
> A command failed during the invocation of macro 
> "VTK_LOAD_CMAKE_EXTENSIONS".
> CMake Error: Error in cmake code at
> /usr/local/lib/vtk-5.0/UseVTK.cmake:35:
> VTK_LOAD_CMAKE_EXTENSIONS unknown error.
> Current CMake stack:
> [2]    /usr/local/lib/vtk-5.0/UseVTK.cmake
> [1]    /Users/shriram/Development/Endurance/CMakeLists.txt
> The end of a CMakeLists file was reached with an IF statement that was 
> not closed properly.
> Within the directory: /Users/shriram/Development/Endurance
> The arguments are: VTK_NEED_LOADED_COMMANDS
> The end of a CMakeLists file was reached with an IF statement that was 
> not closed properly.
> Within the directory: /Users/shriram/Development/Endurance
> The arguments are: COMMAND VTK_WRAP_TCL2
> -- Found Qt-Version 4.3.4
> The end of a CMakeLists file was reached with an IF statement that was 
> not closed properly.
> Within the directory: /Users/shriram/Development/Endurance
> The arguments are: VTK_NEED_LOADED_COMMANDS
> The end of a CMakeLists file was reached with an IF statement that was 
> not closed properly.
> Within the directory: /Users/shriram/Development/Endurance
> The arguments are: COMMAND VTK_WRAP_TCL2
> -- Configuring done
>
> I'm not sure what's causing the problem here. I have tried three 
> versions of cmake including the CVS version.
>
> Any help would be greatly appreciated.
>
> Regards,
> Shriram
>
> ------------------------------------------------------------------------
>
> _______________________________________________
> This is the private VTK discussion list.
> Please keep messages on-topic. Check the FAQ at: http://www.vtk.org/Wiki/VTK_FAQ
> Follow this link to subscribe/unsubscribe:
> http://www.vtk.org/mailman/listinfo/vtkusers
>   

-------------- next part --------------
A non-text attachment was scrubbed...
Name: Shekhar_Chandra.vcf
Type: text/x-vcard
Size: 247 bytes
Desc: not available
URL: <http://www.vtk.org/pipermail/vtkusers/attachments/20080314/ebf9e737/attachment-0001.vcf>


More information about the vtkusers mailing list