[Insight-users] question about fltk to VTK FltkImageViewer

Luis Ibanez luis.ibanez at kitware.com
Mon Mar 7 08:44:43 EST 2005


Hi Uzay,

If you took that application out of the InsightApplications
source tree, then the variables

      InsightApplications_SOURCE_DIR
      InsightApplications_BINARY_DIR

Will not be defined.

CMake defines those variables in response to the command

      PROJECT( InsightApplications )

so, once you take this app out of the source three,
such command line is not parsed by CMake anymore.

You will have to define those two variables manually,
or set them using CMake commands such that the user
will see them when she/he runs CMake.

Something like

SET(InsightApplications_SOURCE_DIR "c:\src\InsightApplications")
SET(InsightApplications_BINARY_DIR "c:\bin\InsightApplications")

at the top of your CMakeLists.txt file, or at least before you
make any reference to InsightApplications_SOURCE_DIR
or InsightApplications_BINARY_DIR




   Regards,



      Luis



------------------
uzay emir wrote:
> Dear Luis
> Thanks for your reply. I have tried what you had wrote. But the result 
> is the same. Then I tired to compile GaussianFilter example outside the 
> Insightapplication folder and again I coul not compile this example. The 
> error is the same code could not see the 
> "InsightApplications_SOURCE_DIR}/Auxiliary/FltkImageViewer"  folder. 
> However this example works under  "InsightApplications_SOURCE_DIR}/ 
> GaussianFilter" folder.
>  
> errors:
> :/Documents and 
> Settings/uzay/Desktop/vtkitkfltk/GaussianFilter/out/liFilterConsole2DGUI.h(8) 
> : fatal error C1083: Cannot open include file: 'fltkLightButton.h': No 
> such file or directory
> liFilterConsole2D.cxx
> C:\Documents and 
> Settings\uzay\Desktop\vtkitkfltk\GaussianFilter\liFilterConsole2D.h(20) 
> : fatal error C1083: Cannot open include file: 'fltkImage2DViewer.h': No 
> such file or directory
> GaussianFilter2D.cxx
> C:\Documents and 
> Settings\uzay\Desktop\vtkitkfltk\GaussianFilter\liFilterConsole2D.h(20) 
> : fatal error C1083: Cannot open include file: 'fltkImage2DViewer.h': No 
> such file or directory
> Generating Code...
> Error executing cl.exe.
> ALL_BUILD - 3 error(s), 3 warning(s)
>  
>  
> The cmake routine that i used is below.
>  
> PROJECT(GaussianFilter)
>  MACRO(ADD_GUI_EXECUTABLE name sources)
>     ADD_EXECUTABLE(${name} ${sources})
>   ENDMACRO(ADD_GUI_EXECUTABLE)
> MACRO(ITK_DISABLE_FLTK_GENERATED_WARNINGS files)
>   IF(${CMAKE_MAJOR_VERSION}.${CMAKE_MINOR_VERSION} GREATER 1.6)
>     IF(CMAKE_COMPILER_IS_GNUCXX)
>       FOREACH(f ${files})
>         STRING(REGEX REPLACE "\\.fl$ <file://\\.fl$>" ".cxx" SRC "${f}")
>         STRING(REGEX REPLACE ".*/([^/]*)$" "\\1 <file://\\1>" SRC "${SRC}")
>         SET_SOURCE_FILES_PROPERTIES(${SRC} PROPERTIES COMPILE_FLAGS -w)
>       ENDFOREACH(f)
>     ENDIF(CMAKE_COMPILER_IS_GNUCXX)
>   ENDIF(${CMAKE_MAJOR_VERSION}.${CMAKE_MINOR_VERSION} GREATER 1.6)
> ENDMACRO(ITK_DISABLE_FLTK_GENERATED_WARNINGS)
>  
>   FIND_PACKAGE(ITK)
>   IF(ITK_FOUND)
>     INCLUDE(${ITK_USE_FILE})
>   ELSE(ITK_FOUND)
>     MESSAGE(FATAL_ERROR
>             "Cannot build InsightApplications without ITK.  Please set 
> ITK_DIR.")
>   ENDIF(ITK_FOUND)
>   FIND_PACKAGE(FLTK)
>   IF(FLTK_FOUND)
>       INCLUDE_DIRECTORIES(${FLTK_INCLUDE_DIR})
>   ENDIF(FLTK_FOUND)
>  
>  
> INCLUDE_DIRECTORIES(
>   ${InsightApplications_SOURCE_DIR}/Auxiliary/FltkImageViewer
>   ${InsightApplications_BINARY_DIR}/Auxiliary/FltkImageViewer
>   ${GaussianFilter_SOURCE_DIR}
>   ${GaussianFilter_BINARY_DIR}
> )
> SET(GaussianFilter_SRCS
>   liFilterConsole.cxx
>   liFilterConsoleBase.cxx
>   GaussianFilter.cxx
>   )
> SET(GaussianFilter2D_SRCS
>   liFilterConsole2D.cxx
>   liFilterConsole2DBase.cxx
>   GaussianFilter2D.cxx
>   )
> ADD_GUI_EXECUTABLE(GaussianFilter   "${GaussianFilter_SRCS}")
> ADD_GUI_EXECUTABLE(GaussianFilter2D "${GaussianFilter2D_SRCS}")
> FLTK_WRAP_UI(GaussianFilter liFilterConsoleGUI.fl)
> FLTK_WRAP_UI(GaussianFilter2D liFilterConsole2DGUI.fl)
> ITK_DISABLE_FLTK_GENERATED_WARNINGS(liFilterConsoleGUI.fl)
> ITK_DISABLE_FLTK_GENERATED_WARNINGS(liFilterConsole2DGUI.fl)
>  
> TARGET_LINK_LIBRARIES(GaussianFilter ITKFltkImageViewer ITKIO 
> ITKBasicFilters)
> TARGET_LINK_LIBRARIES(GaussianFilter2D ITKFltkImageViewer ITKIO 
> ITKBasicFilters)
>  
>  
>  
>  
> I will be very glad if you help me to solve this problem.
> Uzay
>  
> 
> 
> 
> */Luis Ibanez <luis.ibanez at kitware.com>/* wrote:
> 
>     Hi Uzay,
> 
>     You just need to add to your CMakeLists.txt file
>     a line like:
> 
> 
>     INCLUDE_DIRECTORIES(
>     ${InsightApplications_SOURCE_DIR}/Auxiliary/FltkImageViewer
>     )
> 
> 
>     The will add that directory to the path where header files
>     a searched for.
> 
> 
>     NOTE that you shouldn't use an explicit path as you are doing
>     for the link directories:
> 
>      > LINK_DIRECTORIES(
>      > $C:/Program Files/itk/InsightApplications/Auxiliary/FltkImageViewer
> 
> 
>     Just take advantage of the variables
> 
>     InsightApplications_SOURCE_DIR
>     InsightApplications_BINARY_DIR
> 
> 
>     If you are building your project outside of InsightApplications,
>     then you will have to explicitly define these two variables in
>     your CMakeLists.txt file.
> 
> 
> 
>     Regards,
> 
> 
> 
>     Luis
> 
> 
> 
> 
>     ------------------------
>     uzay emir wrote:
> 
>      >! I am trying to build the FLTK to ITK example in Getting Started
>     IV. However I have some problems while I am compiling this code with
>     Visual C++ 6.0. When I tried to build, I got such error.
>      >
>      >
>      >
>      > Configuration: myProject - Win32 Debug--------------------
>      >
>      > Compiling...
>      >
>      > myProjectGUI.cxx
>      >
>      > C:/Program Files/itk/uzay/out/myProjectGUI.h(9) : fatal error
>     C1083: Cannot open include file: 'fltkProgressBar.h': No such file
>     or directory
>      >
>      >
>      >
>      > Although This error I think is due to header files from the
>     FltkImageViewer library that is located in Auxiliary,In my CMAKElist
>     file I include the FltkImageViewer directory. I don’t where I am
>     making mistake. The CMAKE I wrote is outlined below. I will be very
>     glad if anyone helps me.
>      >
>      > PROJECT(myProject)
>      > FIND_PACKAGE
>      > (ITK)
>      > IF( ITK_FOUND)
>      > INCLUDE( ${USE_ITK_FILE} )
>      > ENDIF( ITK_FOUND)
>      > FIND_PACKAGE (FLTK)
>      > IF (FLTK_FOUND)
>      > INCLUDE_DIRECTORIES(${FLTK_INCLUDE_DIR})
>      > ENDIF( FLTK_FOUND)
>      >
>      > LINK_DIRECTORIES(
>      > $C:/Program Files/itk/InsightApplications/Auxiliary/FltkImageViewer
>      > ${InsightApplications_SOURCE_DIR}/Auxiliary/VtkFltk
>      > ${InsightApplications_SOURCE_DIR}/Auxiliary/vtk
>      > ${InsightApplications_BINARY_DIR}/Auxiliary/FltkImageViewer
>      > ${InsightApplications_BINARY_DIR}/Auxiliary/VtkFltk
>      > ${myProject_SOURCE_DIR}
>      > ${myProject_BINARY_DIR}
>      > )
>      >
>      > ADD_EXECUTABLE(myProject myProject.cxx)
>      > IF (FLTK_FOUND)
>      > FLTK_WRAP_UI( myProject myProjectGUI.fl)
>      > ENDIF(FLTK_FOUND)
>      > TARGET_LINK_LIBRARIES( myProject ITKIO ITKFltkImageViewer
>     ITKBasicFilters ITKNumerics ITKCommon ${FLTK_LIBRARIES})
>      >
>      >
>      >
>      >
>      >
>      > Thank you
>      >
>      >
>      >
>      > Uzay Emir
>      >
>      >
>     ------------------------------------------------------------------------
>      > Do you Yahoo!?
>      > Yahoo! Mail
>      >
>      > - You care about security. So do we.
>      >
>      >
>      >
>     ------------------------------------------------------------------------
>      >
>      > _______________________________________________
>      > Insight-users mailing list
>      > Insight-users at itk.org
>      > http://www.itk.org/mailman/listinfo/insight-users
> 
> 
> 
> ------------------------------------------------------------------------
> Celebrate Yahoo!'s 10th Birthday!
> Yahoo! Netrospective: 100 Moments of the Web 
> <http://birthday.yahoo.com/netrospective/>





More information about the Insight-users mailing list