[CMake] QT_WRAP_CPP problem ... fails to generate MOC files ... Please Help !!!

Alexander Neundorf a.neundorf-work at gmx.net
Tue May 15 10:48:44 EDT 2007


On Tuesday 15 May 2007 10:37, Deepak Roy wrote:
> Hello,
>
> I am trying to compile my QT 3.3.4 project with ITK 3.2 and CMake 2.4.
>
> Earlier, i could successfully build the same project using ITK 2.4 and
> CMake 2.0 Patch 6. However, now when i am trying to upgrade my ITK from
> version 2.4 to version 3.2 i am getting CMake build errors.
>
> Specifically, the error is regarding the generation of MOC files using
> QT_WRAP_CPP.
>
> Following is a simplified illustration of my CMakeLists.txt :
>
> ***************************************************************************
>****************
>
> PROJECT(MY_PROJECT)
>
> ...
>
> SET(MY_PROJECT_SRCS_H
>
> a.h
> b.h
> c.h
>
> )
>
> SET(MY_PROJECT_SRCS_CXX
>
> a.cpp
> b.cpp
> c.cpp
>
> )
>
> SET(MY_PROJECT_MOC_SRCS
>
> a.h
> b.h
>
> )
>
> SET(MY_PROJECT_SRCS
>
> ${MY_PROJECT_SRCS_H}
> ${MY_PROJECT_SRCS_CXX}
>
> )
>
> #-------------------------------
> # Generate Moc Files
> #-------------------------------
>
> IF(QT_WRAP_CPP)
>   QT_WRAP_CPP(MY_PROJECT ${MY_PROJECT_SRCS_CXX} ${MY_PROJECT_MOC_SRCS} )
> ENDIF(QT_WRAP_CPP)

Does the following work ?

QT_WRAP_CPP(MY_PROJECT MY_PROJECT_SRCS_CXX ${MY_PROJECT_MOC_SRCS} )

According to the man page only the name of the "destination list" should be 
used:
   QT_WRAP_CPP(resultingLibraryName DestName 
                SourceLists ...) 
      Produce moc files for all the .h files listed in the SourceLists. The
      moc files will be added to the library using the DestName source list.


Bye
Alex


More information about the CMake mailing list