<div>Hello,</div>
<div> </div>
<div>I am trying to compile my QT 3.3.4 project with ITK 3.2 and CMake 2.4.</div>
<div> </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> </div>
<div>Specifically, the error is regarding the generation of MOC files using QT_WRAP_CPP.</div>
<div> </div>
<div>Following is a simplified illustration of my CMakeLists.txt :</div>
<div> </div>
<div>*******************************************************************************************</div>
<div> </div>
<div>PROJECT(MY_PROJECT) </div>
<div> </div>
<div>...</div>
<div> </div>
<div>SET(MY_PROJECT_SRCS_H </div>
<div> </div>
<div>a.h</div>
<div>b.h</div>
<div>c.h</div>
<div> </div>
<div>)</div>
<div> </div>
<div>SET(MY_PROJECT_SRCS_CXX </div>
<div> </div>
<div>a.cpp</div>
<div>b.cpp</div>
<div>c.cpp</div>
<div> </div>
<div>)</div>
<div> </div>
<div>SET(MY_PROJECT_MOC_SRCS</div>
<div> </div>
<div>a.h</div>
<div>b.h</div>
<div> </div>
<div>)</div>
<div> </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> QT_WRAP_CPP(MY_PROJECT ${MY_PROJECT_SRCS_CXX} ${MY_PROJECT_MOC_SRCS} )<br>ENDIF(QT_WRAP_CPP)</p>
<p>...</p>
<div>*******************************************************************************************</div>
<div> </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> </div>
<div>CMake Error: Attempt to add a custom rule to output "moc_a.cxx" which already has a custom rule.<br>CMake Error: Attempt to add a custom rule to output "moc_b.cxx" which already has a custom rule.
</div>
<div> </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> </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> </div>
<div>I would greatly appreciate your help, comments and suggestions.</div>
<div> </div>
<div>Thanks in advance.</div>
<div> </div>
<div>Regards,</div>
<div> </div>
<div>Deepak </div>
<div> </div>
<div> </div>
<div><br> </div>
<div> </div>
<div> </div></div>
<div> </div>
<div> </div>
<div> </div>
<p> </p>
<blockquote dir="ltr" style="MARGIN-RIGHT: 0px">
<p> </p></blockquote>
<div> </div>
<div> </div>
<div> </div>