[Insight-users] Re: Configuring ITK + VTK + FLTK project with CMake

Luis Ibanez luis . ibanez at kitware . com
Wed, 16 Jul 2003 10:44:54 -0400


Hi Yuanjie,


CMake has support for facilitating the
configuration of a project that uses FLTK.

However, FLTK itself is not build with
CMake. Please follow the build instructions
provided by FLTK in order to build this
GUI Toolkit.

   http://www . fltk . org/faq . php


In order to use ITK, VTK and FLTK in your
project, the CMakeLists.txt file of your
project just need to contain the following
lines

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

PROJECT( myApplicationName )

#
#  FIND ITK
#
FIND_PACKAGE(ITK)
IF (USE_ITK_FILE)
  INCLUDE (${USE_ITK_FILE})
ELSE (USE_ITK_FILE)
  MESSAGE( FATAL_ERROR "This application requires ITK. One of these
components is missing. Please verify configuration")
ENDIF (USE_ITK_FILE)


#
# FIND VTK
#
FIND_PACKAGE(VTK)
IF (USE_VTK_FILE)
  INCLUDE (${USE_VTK_FILE})
ELSE (USE_VTK_FILE)
  MESSAGE( FATAL_ERROR "This application requires VTK. One of these
components is missing. Please verify configuration")
ENDIF (USE_VTK_FILE)



#
# FIND FLTK
#
FIND_PACKAGE(FLTK)
IF (FLTK_FOUND)
  INCLUDE_DIRECTORIES (${FLTK_INCLUDE_DIR})
ELSE (FLTK_FOUND)
  MESSAGE( FATAL_ERROR "This application requires FLTK. One of these
components is missing. Please verify configuration")
ENDIF (FLTK_FOUND)


INCLUDE_DIRECTORIES(
  ${myApplicationName_SOURCE_DIR}
  )

#
#  Define the list of source files
#
SET(APPLICATION_SOURCES
  SourceFile1.cxx
  SourceFile2.cxx
  SourceFile3.cxx
  vtkFlRenderWindowInteractor.cxx
  )


ADD_EXECUTABLE( myApplication ${APPLICATION_SOURCES})

FLTK_WRAP_UI(myApplication myApplicationGUI.fl)

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

Note the use of the command:

FLTK_WRAP_IU( )  for managing the fluid files *.fl




Regards,



   Luis





--------------------
zheng yuanjie wrote:
> Hi Luis
> 
> I really appreciate your immediate feedback. I still have another 
> question. If I use Fltk to manage a GUI, how I can configure my program 
> with CMake. Please note that, in FLTK folder there is no any 
> CMakeList.txt file with which CMake can do configurations.
> 
> Thank you in advance!
> 
> Yours, sincerely
> 
> Yuanjie Zheng
> 
> 
> 
> */Luis Ibanez <luis . ibanez at kitware . com>/* wrote:
> 
> 
>     Hi Yuanjie
> 
>     Mixing FLTK and MFC doesn't seem to be a good idea.
> 
>     You will be trying two use two libraries that are
>     designed for the same purpose: Managing a GUI.
> 
>     I would suggest you to choose one or the other.
> 
>     With FLTK you have the advantage of the portability
>     to other platforms.
> 
> 
> 
>     Regards,
> 
> 
>     Luis
> 
> 
> 
>     ----------------------
>     zheng yuanjie wrote:
>      > Hi, Luis
>      >
>      > I have been using/ Microsoft Visual C++ 6.0/ with /Windows XP./
>      >
>      > Would you please tell me if I can combine /MFC/ with /FLTK/ to
>     construct
>      > interface of one program?
>      >
>      > I have tried to combine them, but I failed. My operations are
>     listed below:
>      >
>      > 1. I constructed a new project with /MFC AppWizard(exe)/.
>      >
>      > 2. I tried to link /FLTK/ static libraries in my program. I ! could
>      > succeed in linking /fltkgld.lib/ and/ fltkimagesd.lib/, however I
>      > failedd in doing /fltkd.lib/. When I tried to link /fltkd.lib/, and
>      > debugged the program, an linking error came out as:
>      >
>      > /Linking.../
>      >
>      > /fltkd.lib(fl_call_main.obj) : error LNK2001: unresolved external
>     symbol
>      > _main/
>      >
>      > Would you mind telling me what's wrong with me? Please note that
>     if I
>      > construct a Win32 Application or Win32 ConsoleApplication, i.e.
>     not a
>      > MFC based one, I can succeed in linking all the libraries of FLTK.
>      >
>      > Sincerely yours,
>      >
>      > Yuanjie Zheng
>      >
>      >
>      >
>      >
>      >
>     ------------------------------------------------------------------------
>      > *Do You Yahoo!?*
>      > 国内电邮用户反垃圾调查拉开帷幕
>      >
>      >
> 
> 
> 
> ------------------------------------------------------------------------
> ! *Do You Yahoo!?*
> 国内电邮用户反垃圾调查拉开帷幕 
> <http://cn . rd . yahoo . com/mail_cn/tag/?http://cn . tech . yahoo . com/zhuanti/laji/index . html> 
>