[Insight-users] Re: Errors of Qt + ITK Integration resolved

Luis Ibanez luis.ibanez@kitware.com
Fri May 21 23:36:02 EDT 2004


Hi Venkata,

Thanks for letting us know of your success linking
to Qt extended libraries. We will look at merging
your FindQt.cmake file with the one distributed
with CMake.

About your next step, the CUSTOM_COMMAND is the
way to go.

Note that depending on the CMake version you are
using, the syntax of this command may be a bit
different. To make sure use the help-command in
Cmake.  That is, in the command line type:

   cmake --help-command ADD_CUSTOM_COMMAND

that will display the documentation page for
this command in the particular CMakeversion that
you are using.


Since you actually have three commands to execute,
probably the best way to go is to create three
ADD_CUSTOM_COMMAND lines, one correspondin to
each one of your three commands.


For example your command

midl /nologo tmp\obj\release_mt_static\simpleax.idl /tlb
  tmp\obj\release_mt_static\simpleax.tlb


may become something like:


   ADD_CUSTOM_COMMAND(
       OUTPUT   tmp\obj\release_mt_static\simpleax.tlb
       COMMAND  midl
       ARGS /nologo tmp\obj\release_mt_static\simpleax.idl /tlb
            tmp\obj\release_mt_static\simpleax.tlb
       DEPENDS tmp\obj\release_mt_static\simpleax.idl
       )

and the command:

   $(QTDIR)\bin\idc.exe Debug\simpleax.exe /tlb
   tmp\obj\release_mt_static\simpleax.tlb


should become something like


   ADD_CUSTOM_COMMAND(
       COMMAND  $(QTDIR)\bin\idc.exe
       ARGS $(QTDIR)\bin\idc.exe Debug\simpleax.exe /tlb
                tmp\obj\release_mt_static\simpleax.tlb
       DEPENDS  Debug\simpleax.exe
       )


Please let us know if you find any problems
in this second part of converting your project
to CMake.



    Thanks



      Luis




------------------
Venkata wrote:

> Hello Luis,
> 
>  
> 
> I am happy to inform you that I cleared all my errors. Thanks a lot for 
> guiding me. For your reference I attached the modified FindQt.cmake file 
> and CMakelists.txt file. Now it is working fine. I totally removed 
> qt-mt331.lib and –DQT_DLL option. I linked to qaxserver.lib, qt-mt.lib 
> and qtmain.lib.
> 
>  
> 
> I need to do one more thing for my final result. The purpose of using 
> qaxserver.lib is for ActiveX Component. As I once mailed you before pure 
> Qt applications use pro file similar to we use CMAKE for ITK. Just the 
> line *config+= qt activeqt *in pro file links it to qaxserver.lib and 
> also sets some Post-build step (in MS Visual Studio settings) options 
> for the whole functionality of ActiveQt component. Now I overcame the 
> problem of linking to the qaxserver.lib and I am left with the 
> Post-build steps. Below are the lines present in the post-build step of 
> a simple ActiveQt example.
> 
> -----------------------------------------------------------------
> 
> Debug\simpleax.exe -dumpidl tmp\obj\release_mt_static\simpleax.idl 
> -version 1.0
> 
>  
> 
> midl /nologo tmp\obj\release_mt_static\simpleax.idl /tlb 
> tmp\obj\release_mt_static\simpleax.tlb
> 
>  
> 
> $(QTDIR)\bin\idc.exe Debug\simpleax.exe /tlb 
> tmp\obj\release_mt_static\simpleax.tlb
> 
>  
> 
> Debug\simpleax.exe –regserver
> 
> -----------------------------------------------------------------
> 
>  
> 
> simpleax.exe is final executable.
> 
>  
> 
> Now my problem is how to get these lines in Post-build step using CMake. 
> I need to add some extra commands in either FindQt.cmake or 
> CMakeLists.txt file. When I went through CMAKE documentation I could find
> 
>  
> 
> ADD_CUSTOM_COMMAND (TARGET target
>                      PRE_BUILD | PRE_LINK | *POST_BUILD*
>                      COMMAND command
>                      [ARGS [args...]]
>                      [COMMENT comment])
> 
>  
> 
> can be used for this purpose. I am trying to get this done but in BTW 
> please let me know if you have any ideas on this conversion.
> 
>  
> 
> Thanks
> 
> -venkat
> 
> 
> ------------------------------------------------------------------------
> 
> PROJECT(QtSlicer)
> 
> INCLUDE (${CMAKE_ROOT}/Modules/FindOpenGL.cmake)
> INCLUDE (${CMAKE_ROOT}/Modules/FindGLU.cmake)
> 
> 
> #
> #  Find where ITK was Built or Installed.
> #
> FIND_PACKAGE(ITK)
> IF(ITK_FOUND)
>   INCLUDE(${ITK_USE_FILE})
> ELSE(ITK_FOUND)
>   MESSAGE(FATAL_ERROR
>           "Cannot build VolviewPlugIns without ITK.  Please set ITK_DIR.")
> ENDIF(ITK_FOUND)
> 
> 
> 
> 
> INCLUDE (${CMAKE_ROOT}/Modules/FindQt.cmake)
> 
> INCLUDE_DIRECTORIES(
>  ${QT_INCLUDE_DIR}
>  ${QtSlicer_BINARY_DIR}
>  ${QtSlicer_SOURCE_DIR}
> )
> 
> 
> 
> LINK_LIBRARIES(
>  ${ITK_LIBRARIES}
>  #${QT_MT331_LIBRARY}
>  ${QT_MT_LIBRARY}
>  ${QT_QAXSERVER_LIBRARY}
>  ${QT_QTMAIN_LIBRARY}
>  ${QT_GL_LIBRARY}
>  ${OPENGL_glu_LIBRARY}
>  ${OPENGL_LIBRARY}
>  )
> 
> SET(QtSlicer_SRCS 
>   QtSlicerTest.cxx
>   QtGlSliceView.cxx
>   QtSlicer.cxx
>   qaxserver.rc
>   )
> 
> SET(QtSlicer_GUI_SRCS 
>   QtSlicerGUI.ui
>   QtSlicerHelpGUI.ui
> )
> 
> 
> SET(QtSlicer_MOC_SRCS 
>   QtGlSliceView.h
> )
> 
> IF(QT_WRAP_UI)
>   QT_WRAP_UI(QtSlicer QtSlicer_HDRS  QtSlicer_SRCS  QtSlicer_GUI_SRCS )
> ENDIF(QT_WRAP_UI)
> 
> IF(QT_WRAP_CPP)
>   QT_WRAP_CPP(QtSlicer QtSlicer_SRCS QtSlicer_MOC_SRCS)
> ENDIF(QT_WRAP_CPP)
> 
> 
> #ADD_DEFINITIONS(-DQT_DLL)
> 
> ADD_DEFINITIONS(-DQT_THREAD_SUPPORT)
> 
> ADD_DEFINITIONS(-DQT_NO_DEBUG)
> 
> ADD_DEFINITIONS(-DUNICODE)
> 
> ADD_EXECUTABLE(QtSlicer QtSlicer_SRCS)






More information about the Insight-users mailing list