[Insight-users] CMakeLists.txt mistery...

Jean-Philippe Guyon piloo at unc.edu
Fri, 9 Jan 2004 11:45:26 -0500


This is a multi-part message in MIME format.

------=_NextPart_000_0071_01C3D6A6.12BDCE10
Content-Type: multipart/alternative;
	boundary="----=_NextPart_001_0072_01C3D6A6.12BDCE10"


------=_NextPart_001_0072_01C3D6A6.12BDCE10
Content-Type: text/plain;
	charset="iso-8859-1"
Content-Transfer-Encoding: 7bit

Hello,

I try to compile a project outside of the Insight repository, and I get the
following error at link time:

------ Build started: Project: Vetot, Configuration: Release Win32 ------

Linking...

LINK : fatal error LNK1104: cannot open file 'ITKAlgorithms.lib'

Build log was saved at
"file://c:\piloo\Workspacez\Ils\Vetot-VC++\Release\BuildLog.htm"

Vetot - 1 error(s), 0 warning(s)

I use  Microsoft Visual C++ .Net on a Windows 2000 workstation.
I have been trying to figure out the cause for this error but I
unfortunately ran out of ideas after a while.
Although, when I checked the properties of the solution file generated with
CMake 1.8.3, the following lines were defined in the 'Additional Library
Directories' :

C:\piloo\Workspacez\Insight-VC++\bin\$(INTDIR)
C:\piloo\Workspacez\Insight-VC++\bin\

My understanding is that the UseITK.cmake should take care of defining
properly the required paths.It actually seems to be the case based on the
properties of the VC++ .Net solution.
I attached my CMakelists.txt file to this email in case anyone can give me a
clue why this is happening.

Jean-Philippe

ps: I compile my project in release mode. All ITK libraries have been
compiled previously in the same mode and are at the right location, ie in
the /bin directory of my insight binary directory.

------=_NextPart_001_0072_01C3D6A6.12BDCE10
Content-Type: text/html;
	charset="iso-8859-1"
Content-Transfer-Encoding: quoted-printable

<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN">
<HTML><HEAD>
<META http-equiv=3DContent-Type content=3D"text/html; =
charset=3Diso-8859-1">
<META content=3D"MSHTML 6.00.2800.1276" name=3DGENERATOR></HEAD>
<BODY>
<DIV><SPAN class=3D192150716-09012004><FONT face=3DArial color=3D#0000ff =

size=3D2>Hello,</FONT></SPAN></DIV>
<DIV><SPAN class=3D192150716-09012004><FONT face=3DArial color=3D#0000ff =

size=3D2></FONT></SPAN>&nbsp;</DIV>
<DIV><SPAN class=3D192150716-09012004><FONT face=3DArial color=3D#0000ff =

size=3D2>I&nbsp;try to compile a project outside of the Insight =
repository, and I=20
get the following error at link time:</FONT></SPAN></DIV>
<DIV><SPAN class=3D192150716-09012004><FONT face=3DArial color=3D#0000ff =

size=3D2></FONT></SPAN>&nbsp;</DIV>
<DIV><SPAN class=3D192150716-09012004><FONT size=3D1>
<P>------ Build started: Project: Vetot, Configuration: Release Win32 =
------</P>
<P>Linking...</P>
<P>LINK : fatal error LNK1104: cannot open file 'ITKAlgorithms.lib'</P>
<P>Build log was saved at=20
"file://c:\piloo\Workspacez\Ils\Vetot-VC++\Release\BuildLog.htm"</P>
<P>Vetot - 1 error(s), 0 warning(s)</P>
<P></FONT></SPAN><SPAN class=3D192150716-09012004><FONT face=3DArial =
color=3D#0000ff=20
size=3D2>I use&nbsp; Microsoft Visual C++ .Net on a Windows 2000=20
workstation.<BR></FONT></SPAN><SPAN class=3D192150716-09012004><FONT =
face=3DArial=20
color=3D#0000ff size=3D2>I have been trying to figure out the cause for =
this error=20
but I unfortunately ran out of ideas after a =
while.<BR></FONT></SPAN><SPAN=20
class=3D192150716-09012004><FONT face=3DArial color=3D#0000ff =
size=3D2>Although, when I=20
checked the properties of the solution file generated with CMake 1.8.3, =
the=20
following lines were defined in the 'Additional Library Directories'=20
:<BR><BR></FONT></SPAN><SPAN class=3D192150716-09012004><FONT =
face=3DArial=20
color=3D#0000ff=20
size=3D2>C:\piloo\Workspacez\Insight-VC++\bin\$(INTDIR)<BR></FONT></SPAN>=
<SPAN=20
class=3D192150716-09012004><FONT face=3DArial color=3D#0000ff=20
size=3D2>C:\piloo\Workspacez\Insight-VC++\bin\<BR><BR></FONT></SPAN><SPAN=
=20
class=3D192150716-09012004><FONT face=3DArial color=3D#0000ff =
size=3D2>My understanding=20
is that&nbsp;the UseITK.cmake&nbsp;should&nbsp;take=20
care&nbsp;of&nbsp;defining&nbsp;properly the required paths.It actually =
seems to=20
be the case based on the properties of the VC++ .Net solution.<BR>I =
attached my=20
CMakelists.txt file to this email in case anyone can give me a clue why =
this is=20
happening.<BR><BR>Jean-Philippe<BR><BR>ps: I compile my project in =
release mode.=20
All ITK libraries have been compiled previously in the same mode and are =
at the=20
right location, ie in the /bin directory of my insight binary=20
directory.</FONT></SPAN></P></DIV></BODY></HTML>

------=_NextPart_001_0072_01C3D6A6.12BDCE10--

------=_NextPart_000_0071_01C3D6A6.12BDCE10
Content-Type: text/plain;
	name="CMakeLists.txt"
Content-Transfer-Encoding: quoted-printable
Content-Disposition: attachment;
	filename="CMakeLists.txt"

PROJECT( Vetot )

# Include CMake modules to locate the toolkits
# necessary for VETOT...

INCLUDE( ${CMAKE_ROOT}/Modules/FindITK.cmake )
INCLUDE( ${CMAKE_ROOT}/Modules/FindFLTK.cmake )
INCLUDE( ${CMAKE_ROOT}/Modules/FindOpenGL.cmake )
INCLUDE( ${CMAKE_ROOT}/Modules/FindVTK.cmake )

# Looking for the ITK package...

FIND_PACKAGE(ITK)
  IF(ITK_FOUND)
    INCLUDE(${ITK_USE_FILE})
  ELSE(ITK_FOUND)
    MESSAGE(FATAL_ERROR "Vetot cannot be compiled without ITK. Please =
install ITK on your computer"
                        " or specify its location manually.")
  ENDIF(ITK_FOUND)

# Looking for the VTK package...

FIND_PACKAGE(VTK)
  IF (VTK_FOUND)
    INCLUDE (${VTK_USE_FILE})

    # Test for VTK using std libs...
   =20
    IF(NOT VTK_USE_ANSI_STDLIB)
      MESSAGE("Warning.  Your VTK was not built with the =
VTK_USE_ANSI_STDLIB "
              "option ON.  Link errors may occur.  Consider re-building =
VTK "
              "with this option ON.  For MSVC 6, you MUST turn on the =
VTK "
              "option.  ITK will not link otherwise.")
    ENDIF(NOT VTK_USE_ANSI_STDLIB)

    # Test for VTK building Hybrid...
   =20
    IF(NOT VTK_USE_HYBRID)
      MESSAGE("Your VTK was not built with the VTK_USE_HYBRID option ON. =
 "
              "Please reconfigure and recompile VTK with this option =
before "
              "trying to use it with ITK.")
      SET(VTK_FOUND 0)
    ENDIF(NOT VTK_USE_HYBRID)
  ELSE(VTK_FOUND)
    MESSAGE(FATAL_ERROR "Vetot cannot be compiled without VTK. Please =
install VTK on your computer"
                        " or specify its location manually.")
  ENDIF (VTK_FOUND)

# Looking for the itkUNC package...

INCLUDE( ${Vetot_SOURCE_DIR}/FindITKUNC.cmake )

IF(USE_ITKUNC_FILE)

  INCLUDE(${USE_ITKUNC_FILE})

  IF(itkUNC_SOURCE_DIR)

    # Looking for the InsightApplications package...
    INCLUDE( ${itkUNC_SOURCE_DIR}/FindInsightApplications.cmake )

    IF(InsightApplications_SOURCE_DIR)

      INCLUDE( =
${InsightApplications_SOURCE_DIR}/FindFltkImageViewer.cmake )   =20

      # Include subdirectories...
      SUBDIRS( Plugins )

      # Definition of directories where include files can
      # be found...
      INCLUDE_DIRECTORIES(
        ${FLTK_INCLUDE_PATH}
        ${OPENGL_INCLUDE_PATH}

        ${Vetot_SOURCE_DIR}
        ${Vetot_SOURCE_DIR}/Common
        ${Vetot_SOURCE_DIR}/Filters
        ${Vetot_SOURCE_DIR}/IO
        ${Vetot_SOURCE_DIR}/Helpers
        ${Vetot_SOURCE_DIR}/Plugins
        ${Vetot_SOURCE_DIR}/Plugins/ProgressWindow
        ${Vetot_SOURCE_DIR}/Plugins/HandTracer
        ${Vetot_SOURCE_DIR}/Plugins/HistogramViewer
        ${Vetot_SOURCE_DIR}/Plugins/ImageViewer
        ${Vetot_SOURCE_DIR}/Plugins/ImageViewer/PngImageViewer
        ${Vetot_SOURCE_DIR}/Plugins/ImageViewer/ImageViewer2D
        ${Vetot_SOURCE_DIR}/Plugins/ImageViewer/ImageViewer3D
        ${Vetot_SOURCE_DIR}/Plugins/SlicerOptionWindow
       =20
        ${Vetot_BINARY_DIR}
        ${Vetot_BINARY_DIR}/Common
        ${Vetot_BINARY_DIR}/Plugins
        ${Vetot_BINARY_DIR}/Plugins/ImageViewer
        ${Vetot_BINARY_DIR}/Plugins/ImageViewer/PngImageViewer
        ${Vetot_BINARY_DIR}/Plugins/ImageViewer/ImageViewer2D
        ${Vetot_BINARY_DIR}/Plugins/ImageViewer/ImageViewer3D
        ${Vetot_BINARY_DIR}/Plugins/SlicerOptionWindow
        ${Vetot_BINARY_DIR}/Plugins/ProgressWindow
        ${Vetot_BINARY_DIR}/Plugins/HandTracer
       =20
        =
${InsightApplications_SOURCE_DIR}/LandmarkInitializedMutualInformationReg=
istration
       =20
        ${FltkImageViewer_INCLUDE_DIR}
        ${FltkImageViewer_BINARY_DIR} =20
       =20
        ${itkUNC_SOURCE_DIR}/Code/Filters
        ${itkUNC_SOURCE_DIR}/Code/ObjectViewer/Renderer
        ${itkUNC_SOURCE_DIR}/Code/ObjectViewer/RenderMethod
        =
${itkUNC_SOURCE_DIR}/Code/ObjectViewer/RenderMethod/OpenGL/Slicer
        ${itkUNC_SOURCE_DIR}/Code/ObjectViewer/RenderMethod/OpenGL/2D =20
        ${itkUNC_SOURCE_DIR}/Code/ObjectViewer/RenderMethod/OpenGL/3D =20
        ${itkUNC_SOURCE_DIR}/Code/ObjectViewer/RenderMethod/VTK/3D/VTK4
        ${itkUNC_SOURCE_DIR}/Code/ObjectViewer/Display
        ${itkUNC_SOURCE_DIR}/Code/ObjectViewer/Display/Fltk
      )
     =20
      SET( FileToCopy_SRCS
        resources/SplashScreen.gif
        Plugins/Fl_ColoredButton.h
        Plugins/ImageViewer/PngImageViewer/PngImageSliceViewer.h
        Plugins/ImageViewer/ImageViewer2D/ImageViewer2D.h
        Plugins/ImageViewer/ImageViewer3D/ImageViewer3D.h
        Help/LoadStudyHelp.html
        Help/SegmentationHelp.html
        Help/RegistrationHelp.html
        Help/VisualizationHelp.html
        Help/SaveStudyHelp.html
        Help/PreferencesHelp.html
        Help/SegmentationPreferencesHelp.html
        Help/RegistrationPreferencesHelp.html
      )

      # Copy necessary files to the destination directory...
     =20
      FOREACH(FileToCopy ${FileToCopy_SRCS})
        CONFIGURE_FILE(
          ${Vetot_SOURCE_DIR}/${FileToCopy}
          ${Vetot_BINARY_DIR}/${FileToCopy} COPYONLY)
      ENDFOREACH(FileToCopy)

      # Define the list of source files...=20
         =20
      SET( Vetot_SRCS
        Common/itkTumorSpatialObject.h
        Common/itkTumorSpatialObject.txx
        Common/Vetot.cxx
        Common/VetotCallback.h
        Common/VetotCommand.h
        Common/VetotCommand.cxx
        Common/VetotCore.h
        Common/VetotCore.cxx
        Common/VetotDisplay.h
        Common/VetotDisplay.cxx
        Common/VetotDisplayCallback.h
        Common/VetotDisplayUtilities.h
        Common/VetotDisplayUtilities.cxx
        Common/VetotEvent.h
        Common/VetotGUI.h
        Common/VetotGUI.cxx
        Common/VetotGUICallback.h
        Common/VetotLandmarkEvent.h
        Common/VetotMacro.h
        Common/VetotParameters.h
        Common/VetotRegistration.h
        Common/VetotRegistration.cxx
        Common/VetotSegmentation.h
        Common/VetotSegmentation.cxx
        Common/VetotSegmentationCallback.h
        Common/VetotSegmentEvent.h
        Common/VetotHandSegmentation.h
        Common/VetotHandSegmentation.cxx

        Filters/Cropper.h
        Filters/Cropper.txx
        Filters/Padder.h
        Filters/Padder.txx
        Filters/Smoothener.h
        Filters/Smoothener.txx
        Filters/itkInverseIntensityImageFilter.h
        Filters/itkInverseIntensityImageFilter.txx

        Helpers/CoordSystGenerator.h
        Helpers/CoordSystGenerator.txx
        Helpers/Measurer.h
        Helpers/Measurer.txx
        Helpers/PreProcessor.h
        Helpers/PreProcessor.txx
        Helpers/Registrator.h
        Helpers/Registrator.txx
        Helpers/Resampler.h
        Helpers/Resampler.txx
        Helpers/Segmenter.h
        Helpers/Segmenter.txx
        Helpers/SegmenterProgressCommand.h
        Helpers/SegmenterProgressCommand.cxx

        IO/VetotIO.h
        IO/VetotIO.cxx
        IO/VetotIOModule.h
        IO/VetotIOModule.cxx
        IO/VetotIOEvent.h
        IO/VetotMetaIO.h
        IO/VetotMetaIO.cxx
        IO/VetotStudyIO.h
        IO/VetotStudyIO.cxx
        IO/VetotExportIO.h
        IO/VetotExportIO.cxx     =20
        IO/VetotPreferencesIO.h
        IO/VetotPreferencesIO.cxx       =20
      =20
        Plugins/Fl_SplashScreen.h
        Plugins/Fl_SplashScreen.cxx
        Plugins/Fl_ColoredButton.h
        Plugins/Fl_ColoredButton.cxx

        =
${InsightApplications_SOURCE_DIR}/LandmarkInitializedMutualInformationReg=
istration/LandmarkRegistrator.h
        =
${InsightApplications_SOURCE_DIR}/LandmarkInitializedMutualInformationReg=
istration/LandmarkRegistrator.cxx
      )

      SET( Vetot_LIBRARIES
        # ITK libraries...
        ${ITK_LIBRARIES}
       =20
        # FLTK libraries...
        ${FLTK_LIBRARY}
       =20
        # OpenGl libraries...
        ${OPENGL_LIBRARY}
       =20
        # ITK Applications libraries...
        ${FltkImageViewer_LIBRARY}    =20
       =20
        # VTK libraries... =20
        #${VTK_LIBRARY_DIRS}/release/vtkRendering
        #${VTK_LIBRARY_DIRS}/release/vtkHybrid
       =20
        # Vetot internal libraries...
        HandTracer
        ProgressWindow
        SlicerOptionWindow
        HistogramViewer
        PngImageViewer
        ImageViewer2D
        ImageViewer3D
       =20
        # ITK UNC libraries...
        #${itkUNC_BINARY_DIR}/bin/release/ObjectViewer
        #${itkUNC_BINARY_DIR}/bin/release/RenderMethod
        #${itkUNC_BINARY_DIR}/bin/release/solVTKRenderMethod
        #${itkUNC_BINARY_DIR}/bin/release/solOpenGLRenderMethod
       =20
        # ITK Applications libraries...
        LandmarkInitializedMutualInformationRegistration
      )

      # Definition of path to the directories containing
      # the library necessary for VETOT...

      LINK_DIRECTORIES(
     =20
        # Insight Applications libraries path...
        =
${InsightApplications_BINARY_DIR}/LandmarkInitializedMutualInformationReg=
istration =20
        ${InsightApplications_BINARY_DIR}/Auxiliary/FltkImageViewer

        # ITK UNC libraries path...
        ${itkUNC_BINARY_DIR}
        ${itkUNC_BINARY_PATH}       =20
              =20
        # VTK libraries path...
        #${VTK_LIBRARY_DIRS}
               =20
        # Vetot internal libraries path...
        ${Vetot_BINARY_DIR}/Plugins/ProgressWindow
        ${Vetot_BINARY_DIR}/Plugins/HandTracer
        ${Vetot_BINARY_DIR}/Plugins/HistogramViewer
        ${Vetot_BINARY_DIR}/Plugins/SlicerOptionWindow
        ${Vetot_BINARY_DIR}/Plugins/ImageViewer/PngImageViewer
        ${Vetot_BINARY_DIR}/Plugins/ImageViewer/ImageViewer2D
        ${Vetot_BINARY_DIR}/Plugins/ImageViewer/ImageViewer3D
      )
     =20
      # Define the executable...

      ADD_EXECUTABLE( Vetot Vetot_SRCS )        =20
      TARGET_LINK_LIBRARIES( Vetot ${Vetot_LIBRARIES} )
      FLTK_WRAP_UI( Vetot Common/VetotGUIBase.fl )

    ELSE(InsightApplications_SOURCE_DIR)
      MESSAGE("VETOT cannot be built without InsightApplications.  "
              "Please make sure you specify the path to the =
InsightApplications directory "
              "and run CMake again. If you have not downloaded =
InsightApplications, please"
              " refer to http://www.itk.org.")
    ENDIF(InsightApplications_SOURCE_DIR)
  ENDIF(itkUNC_SOURCE_DIR)
ELSE(USE_ITKUNC_FILE)
  MESSAGE("VETOT cannot be built without itkUNC.  "
          "Please make sure you specify the path to the your itkUNC =
directory "
          "and run CMake again. If you have not downloaded itkUNC yet, =
please refer"
          " to http://www.caddlab.rad.unc.edu.")=20
ENDIF(USE_ITKUNC_FILE)
------=_NextPart_000_0071_01C3D6A6.12BDCE10--