<div>Hello,</div>
<div>&nbsp;</div>
<div>I am trying to compile my QT 3.3.4&nbsp;project with ITK 3.2 and CMake 2.4.</div>
<div>&nbsp;</div>
<div>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.</div>
<div>&nbsp;</div>
<div>Specifically, the error is regarding the generation of MOC files using QT_WRAP_CPP.</div>
<div>&nbsp;</div>
<div>Following is a simplified&nbsp;illustration of my CMakeLists.txt :</div>
<div>&nbsp;</div>
<div>*******************************************************************************************</div>
<div>&nbsp;</div>
<div>PROJECT(MY_PROJECT) </div>
<div>&nbsp;</div>
<div>...</div>
<div>&nbsp;</div>
<div>SET(MY_PROJECT_SRCS_H&nbsp;&nbsp; </div>
<div>&nbsp;</div>
<div>a.h</div>
<div>b.h</div>
<div>c.h</div>
<div>&nbsp;</div>
<div>)</div>
<div>&nbsp;</div>
<div>SET(MY_PROJECT_SRCS_CXX </div>
<div>&nbsp;</div>
<div>a.cpp</div>
<div>b.cpp</div>
<div>c.cpp</div>
<div>&nbsp;</div>
<div>)</div>
<div>&nbsp;</div>
<div>SET(MY_PROJECT_MOC_SRCS</div>
<div>&nbsp;</div>
<div>a.h</div>
<div>b.h</div>
<div>&nbsp;</div>
<div>)</div>
<div>&nbsp;</div>
<div>
<p>SET(MY_PROJECT_SRCS</p>
<p>${MY_PROJECT_SRCS_H}<br>${MY_PROJECT_SRCS_CXX}</p>
<p>) </p>
<p>#------------------------------- <br># Generate Moc Files<br>#------------------------------- </p>
<p>IF(QT_WRAP_CPP)<br>&nbsp; QT_WRAP_CPP(MY_PROJECT ${MY_PROJECT_SRCS_CXX} ${MY_PROJECT_MOC_SRCS} )<br>ENDIF(QT_WRAP_CPP)</p>
<p>...</p>
<div>*******************************************************************************************</div>
<div>&nbsp;</div>
<div>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:</div>
<div>&nbsp;</div>
<div>CMake Error: Attempt to add a custom rule to output &quot;moc_a.cxx&quot; which&nbsp;already has a custom rule.<br>CMake Error: Attempt to add a custom rule to output &quot;moc_b.cxx&quot; which&nbsp;already has a custom rule.
</div>
<div>&nbsp;</div>
<div>I am not able to figure what exactly the problem is, but i am guessing it has something to do with QT_WRAP_CPP.</div>
<div>&nbsp;</div>
<div>A similar question was asked on this mailing list before, but no one replied: <a href="http://public.kitware.com/pipermail/cmake/2005-October/007400.html">http://public.kitware.com/pipermail/cmake/2005-October/007400.html
</a>.</div>
<div>&nbsp;</div>
<div>I would greatly appreciate your&nbsp;help, comments and suggestions.</div>
<div>&nbsp;</div>
<div>Thanks in advance.</div>
<div>&nbsp;</div>
<div>Regards,</div>
<div>&nbsp;</div>
<div>Deepak&nbsp;</div>
<div>&nbsp;</div>
<div>&nbsp;</div>
<div><br>&nbsp;</div>
<div>&nbsp;</div>
<div>&nbsp;</div></div>
<div>&nbsp;</div>
<div>&nbsp;</div>
<div>&nbsp;</div>
<p>&nbsp;</p>
<blockquote dir="ltr" style="MARGIN-RIGHT: 0px">
<p>&nbsp;</p></blockquote>
<div>&nbsp;</div>
<div>&nbsp;</div>
<div>&nbsp;</div>