MantisBT - CMake
View Issue Details
0014981CMakeCMakepublic2014-06-20 04:122015-03-02 08:57
aseguralasa 
Stephen Kelly 
normalmajorhave not tried
closedfixed 
CMake 3.0 
CMake 3.0.2CMake 3.1 
0014981: AUTOUIC not generating all needed ui_xxx.h files
The AUTOUIC feature in CMake 3 does not generate all headers included in sources even if corresponding xxx.ui files exist.

1) In particular, if one file has more than one #include "ui_*.h", only the last one is generated. This may be quite uncommon but happens several times in our projects.


2) Also, even if there is only one #include "ui_*.h" per file, in some situations only one of the corresponding headers is generated.



I set severity to Major because this makes this feature unusable in several of our projects and we have to go back to using QT4/5_WRAP_UI...
Case 1)

forms.h:

#include "ui_form1.h"
#include "ui_form2.h" -> only this one generated

Case 2)

a.h:

#include "ui_a.h"

b.h

#include "ui_b.h"


Only one of them is generated (e.g. ui_b.h). If I comment out the #include ui_b.h line then the other, ui_a.h is generated.

BTW, I looked at the code in cmQtAutoGenerators.cxx. Function ParseForUic (line 1779+) seems to be doing case 1. Even if the regex is tested several times in a while loop, its matched result "basename" is always stored in the same map key, erasing previous values:

includedUis[absPath] = basename;

basename changes in each iteration, but absPath remains the name of the header analyzed. So there can be only one ui per header.

I do not understand why case 2 happens...
No tags attached.
gz qtuic.tar.gz (1,251) 2014-06-26 08:33
https://public.kitware.com/Bug/file/5176/qtuic.tar.gz
Issue History
2014-06-20 04:12aseguralasaNew Issue
2014-06-21 05:29Stephen KellyAssigned To => Stephen Kelly
2014-06-21 05:29Stephen KellyStatusnew => assigned
2014-06-26 08:33Stephen KellyFile Added: qtuic.tar.gz
2014-06-26 08:34Stephen KellyNote Added: 0036259
2014-06-26 08:43aseguralasaNote Added: 0036260
2014-06-26 08:45aseguralasaNote Edited: 0036260bug_revision_view_page.php?bugnote_id=36260#r1506
2014-06-26 09:22Stephen KellyNote Added: 0036261
2014-07-03 03:11sudakov_ivanNote Added: 0036315
2014-09-02 11:47aseguralasaNote Added: 0036700
2014-09-02 11:50Brad KingFixed in Version => CMake 3.0.2
2014-09-02 11:50Brad KingTarget Version => CMake 3.0.2
2014-09-02 11:51Brad KingNote Added: 0036701
2014-09-11 09:20Brad KingStatusassigned => resolved
2014-09-11 09:20Brad KingResolutionopen => fixed
2014-09-15 19:19Stephen KellyNote Added: 0036806
2014-09-15 19:19Stephen KellyStatusresolved => feedback
2014-09-15 19:19Stephen KellyResolutionfixed => reopened
2014-09-16 03:44aseguralasaNote Added: 0036812
2014-09-16 03:44aseguralasaStatusfeedback => assigned
2014-09-22 09:36Stephen KellyStatusassigned => resolved
2014-09-22 09:36Stephen KellyFixed in VersionCMake 3.0.2 => CMake 3.1
2014-09-22 09:36Stephen KellyResolutionreopened => fixed
2015-03-02 08:57Robert MaynardNote Added: 0038129
2015-03-02 08:57Robert MaynardStatusresolved => closed

Notes
(0036259)
Stephen Kelly   
2014-06-26 08:34   
To test case 2, I created the testcase attached. Can you test it and report if it works for you?
(0036260)
aseguralasa   
2014-06-26 08:43   
(edited on: 2014-06-26 08:45)
Fails to build. Only "ui_widget2.h" was generated! (BTW, using VS2010 32bit)

Build Output:

 Description: Automatic moc and uic for target main
 Generating ui_widget2.h
 Generating moc_widget1.cpp
 Generating moc_widget2.cpp


Thanks for creating that test case!

(0036261)
Stephen Kelly   
2014-06-26 09:22   
It worked for me, but I was using master. I knew your issue sounded familiar, and I have a memory of fixing it.

That was done in commit 71a11252 (QtAutogen: Fix use of multiple ui files in a single target., 2014-03-25), but I suppose I missed the fact that it wasn't merged to the release branch and I didn't request that.

Case 1 is still reproducible in master though.
(0036315)
sudakov_ivan   
2014-07-03 03:11   
So when will your changes be in release?
(0036700)
aseguralasa   
2014-09-02 11:47   
Any news?

CMake 3.0.1 was released and there is no mention in the changelog.
(0036701)
Brad King   
2014-09-02 11:51   
Re 0014981:0036700: The fix has been merged for inclusion in 3.0.2.
(0036806)
Stephen Kelly   
2014-09-15 19:19   
The 'case 1' bug is still present. Re-opening this one.
(0036812)
aseguralasa   
2014-09-16 03:44   
In the "Additional Information" box I provided a short hint to the possible cause of that behavior by pointing to a specific part of the code. I can try to propose a fix.
(0038129)
Robert Maynard   
2015-03-02 08:57   
Closing resolved issues that have not been updated in more than 4 months.