[Insight-users] cmake question

William A. Hoffman billlist at nycap.rr.com
Wed, 11 Feb 2004 13:56:24 -0500


To reference an evnironment variable in cmake you do this:
$ENV(VAR), so this:

 LINK_DIRECTORIES(
${VTKQT_LIBRARY_PATH}
)

Is most likely doing nothing.  To see the commands used, you can
do make VERBOSE=1.

I would recommend using a FIND_LIBRARY call in the cmake file
to find the VtkQt library.   CMake is meant to avoid the use
of environment variables if possible.

-Bill

At 08:20 AM 2/11/2004, David Macias Verde wrote:
>Hello:
>
>I am trying to make my first steps with cmake. Before that I was using
>qmake as I am working qt,vtk and, now, itk. I can't compile my code
>because of this error:
>
>Building dependencies. cmake.depends...
>-- Loading VTK CMake commands
>-- Loading VTK CMake commands - done
>Building object file main.o...
>Building object file mirs-1.1.o...
>Building executable /home/dmacias/src/mytools/mirs-1.3/myProject...
>/usr/bin/ld: cannot find -lVtkQt
>collect2: ld returned 1 exit status
>make[1]: *** [/home/dmacias/src/mytools/mirs-1.3/myProject] Error 1
>make: *** [default_target] Error 2
>
>My CMakeList.txt, surely wrong, is:
>
>PROJECT( myProject )
>
>FIND_PACKAGE ( ITK )
>IF (  ITK_FOUND  )
>         INCLUDE(  ${USE_ITK_FILE}  )
>ENDIF(   ITK_FOUND   )
>
>FIND_PACKAGE ( VTK )
>IF (   VTK_FOUND   )
>         INCLUDE(  ${USE_VTK_FILE}  )
>ENDIF(   VTK_FOUND   )
>
># 
># Find QT
>#
>INCLUDE (${CMAKE_ROOT}/Modules/FindQt.cmake)
>
>INCLUDE_DIRECTORIES(
>${QT_INCLUDE_DIR}
>${QT_INCLUDE_PATH}
>/usr/local/VtkQt/src
>${myProject_SOURCE_DIR} 
>/usr/local/InsightApplications-1.6.0/Auxiliary/vtk
>)
>
>LINK_DIRECTORIES(
>${VTKQT_LIBRARY_PATH}
>)
>
>ADD_EXECUTABLE( myProject main.cxx mirs-1.1.cxx  mirs.h )
>
>TARGET_LINK_LIBRARIES ( myProject  
>ITKBasicFilters ITKCommon ITKIO
>vtkRendering  vtkGraphics vtkHybrid
>vtkImaging vtkIO vtkFiltering vtkCommon
>${QT_QT_LIBRARY}
>VtkQt
>)
>
>My .bash_profile is:
># .bash_profile
>
># Get the aliases and functions
>if [ -f ~/.bashrc ]; then
>        . ~/.bashrc
>fi
>
>PATH=/usr/local/bin:/sbin/:/usr/local/sbin/:/bin:/usr/bin:/usr/sbin:/usr/bin/X11:/usr/X11R6/bin:/root/bin:/usr/local/share/tkabber:/usr/local/share/tkabber/jabberlib-tclxml
>
># User specific environment and startup programs
># Place where you packages are:
>export PACKAGES=/usr/local
>export VTK_DIR=$PACKAGES/VTK
>export VTK_DATA=$PACKAGES/VTKData-release-4-2/Data
>export VTK_DATA_ROOT=$PACKAGES/VTKData-release-4-2/Data
>export VTK_HOME=$PACKAGES/VTK
>export PATH=$VTK_HOME/bin:$PACKAGES/include/vtk:$PATH
>export LD_LIBRARY_PATH=$VTK_HOME/bin:$LD_LIBRARY_PATH
>export VTKQT_LIBRARY_PATH=$PACKAGES/VtkQt/lib
>export VTKQT_SRCS=$PACKAGES/VtkQt/src
>
>#The same for VtkQt
>export LD_LIBRARY_PATH=$PACKAGES/VtkQt/lib:$LD_LIBRARY_PATH
>
>unset USERNAME
>
>
>May anyone give a hand?
>
>Thanks
>
>-- 
>David Macias Verde <david.maciasverde at gobiernodecanarias.org>
>Servicio de Física Médica - Hospital de Gran Canaria Dr. Negrín
>
>_______________________________________________
>Insight-users mailing list
>Insight-users at itk.org
>http://www.itk.org/mailman/listinfo/insight-users