[cmake-developers] [CMake 0013572]: Automoc can list moc_*.cpp files twice in ..._automoc.cpp

Mantis Bug Tracker mantis at public.kitware.com
Thu Oct 4 19:51:44 EDT 2012


The following issue has been SUBMITTED. 
====================================================================== 
http://public.kitware.com/Bug/view.php?id=13572 
====================================================================== 
Reported By:                Craig Scott
Assigned To:                
====================================================================== 
Project:                    CMake
Issue ID:                   13572
Category:                   CMake
Reproducibility:            sometimes
Severity:                   minor
Priority:                   normal
Status:                     new
====================================================================== 
Date Submitted:             2012-10-04 19:51 EDT
Last Modified:              2012-10-04 19:51 EDT
====================================================================== 
Summary:                    Automoc can list moc_*.cpp files twice in
..._automoc.cpp
Description: 
If you include the C++ headers in the source files for add_executable() or
add_library, I've encountered situations where CMake's automoc support then
creates duplicate entries in the (target)_automoc.cpp file it creates. It is as
though it identifies the moc_(sourcefile).cpp that it needs from the .cpp files
in the source file list, but then finds the same set of moc_(sourcefile).cpp
files again when it processes the .h files in the source file list. The result
is that the build fails with the compiler complaining about redefinition of
whatever the moc_(sourcefile).cpp files provide.

Steps to Reproduce: 
The problem isn't always reproduceable, but once it does occur, it seems that it
keeps occurring. I've not found any way to reliably trigger or not trigger the
issue, unfortunately. I've had cases where I've been building with the headers
included in the source list for months. Then I change something and I start
getting the duplicate problem. Today, it seems I can omit the headers from the
source file list and that seems to work. Not sure if that's a solution in
general, but it would seem that headers should be allowed to be included in the
source file list (I believe this was actually necessary for some earlier
versions of CMake and using some combination of features needed for Qt support).

Additional Information: 
Seen with CMake 2.8.8 and 2.8.9.
====================================================================== 

Issue History 
Date Modified    Username       Field                    Change               
====================================================================== 
2012-10-04 19:51 Craig Scott    New Issue                                    
======================================================================




More information about the cmake-developers mailing list