[Insight-users] QT_WRAP_CPP problem ... fails to generate MOC files

Deepak Roy cdeepakroy at gmail.com
Mon May 7 11:34:17 EDT 2007


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)

...
*******************************************************************************************

when i build the above CMakeLists with CMake 2.4, i am receiving errors for
all the moc files in ${MY_PROJECT_MOC_SRCS}. The errors are like the
following:

CMake Error: Attempt to add a custom rule to output "moc_a.cxx"
which already has a custom rule.
CMake Error: Attempt to add a custom rule to output "moc_b.cxx"
which already has a custom rule.

I am not able to figure what exactly the problem is, but i am guessing it
has something to do with QT_WRAP_CPP.

A similar question was asked on this mailing list before, but no one
replied: http://public.kitware.com/pipermail/cmake/2005-October/007400.html.

I would greatly appreciate your help, comments and suggestions.

Thanks in advance.

Regards,

Deepak
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://public.kitware.com/pipermail/insight-users/attachments/20070507/25dcad63/attachment-0001.html


More information about the Insight-users mailing list