MantisBT - CMake
View Issue Details
0009955CMakeModulespublic2009-11-23 09:162016-06-10 14:31
Pau Garcia i Quiles 
Clinton Stimpson 
normalfeaturealways
closedmoved 
CMake-2-8 
 
0009955: qt4_automoc fails if .h and .cpp in different directories
In the FindQt4.cmake module, if you use qt4_automoc instead of qt4_wrapp_cpp, and the .h and the .cpp files are in different directories, qt4_automoc fails because it looks for the .h file in the same directory the .cpp file is.
Also happens in 2.6.4

See the attached file for an example:

- The 'samedir' directory contains a KDevelop4-generated CMake project where the .h and the .cpp are in the same directory. In this case, qt4_automoc works fine.

- The 'differentdir' directory contains a modified version of the 'samedir' directory: now the .h and the .cpp are in different directories. In this case, qt4_automoc works fails.
No tags attached.
bz2 automoctest.tar.bz2 (1,140) 2009-11-23 09:16
https://public.kitware.com/Bug/file/2690/automoctest.tar.bz2
diff automoc_using_includes.diff (2,616) 2014-06-12 07:40
https://public.kitware.com/Bug/file/5162/automoc_using_includes.diff
diff automoc_using_includes_with_tests.diff (5,581) 2014-07-31 09:26
https://public.kitware.com/Bug/file/5207/automoc_using_includes_with_tests.diff
diff automoc_using_includes_with_qtautogen_tests.diff (4,769) 2014-08-07 04:37
https://public.kitware.com/Bug/file/5220/automoc_using_includes_with_qtautogen_tests.diff
Issue History
2009-11-23 09:16Pau Garcia i QuilesNew Issue
2009-11-23 09:16Pau Garcia i QuilesFile Added: automoctest.tar.bz2
2009-11-23 10:59Bill HoffmanStatusnew => assigned
2009-11-23 10:59Bill HoffmanAssigned To => Clinton Stimpson
2009-12-08 09:31Bill HoffmanAssigned ToClinton Stimpson => Alex Neundorf
2009-12-09 14:42Alex NeundorfNote Added: 0018744
2009-12-23 12:56Alex NeundorfNote Added: 0018989
2009-12-23 12:56Alex NeundorfAssigned ToAlex Neundorf => Clinton Stimpson
2012-08-13 23:25Clinton StimpsonStatusassigned => backlog
2014-06-12 07:40Lode LeroyFile Added: automoc_using_includes.diff
2014-06-12 08:42Clinton StimpsonNote Added: 0036165
2014-07-31 09:26Lode LeroyFile Added: automoc_using_includes_with_tests.diff
2014-08-04 11:07Clinton StimpsonNote Added: 0036545
2014-08-04 11:07Clinton StimpsonStatusbacklog => resolved
2014-08-04 11:07Clinton StimpsonResolutionopen => fixed
2014-08-04 11:09Clinton StimpsonStatusresolved => feedback
2014-08-04 11:09Clinton StimpsonResolutionfixed => reopened
2014-08-04 11:10Clinton StimpsonNote Added: 0036546
2014-08-04 11:10Clinton StimpsonStatusfeedback => resolved
2014-08-04 11:10Clinton StimpsonResolutionreopened => fixed
2014-08-05 09:48Clinton StimpsonNote Added: 0036552
2014-08-05 09:48Clinton StimpsonStatusresolved => feedback
2014-08-05 09:48Clinton StimpsonResolutionfixed => reopened
2014-08-05 10:57Clinton StimpsonNote Added: 0036554
2014-08-07 04:37Lode LeroyFile Added: automoc_using_includes_with_qtautogen_tests.diff
2014-08-07 04:38Lode LeroyNote Added: 0036567
2016-06-10 14:27Kitware RobotNote Added: 0041626
2016-06-10 14:27Kitware RobotStatusfeedback => resolved
2016-06-10 14:27Kitware RobotResolutionreopened => moved
2016-06-10 14:31Kitware RobotStatusresolved => closed

Notes
(0018744)
Alex Neundorf   
2009-12-09 14:42   
I don't think I'll fix this.
This is hard to do with pure cmake script.
The good solution for this is to take automoc4 from kdesvn/automoc/, port it from Qt to plain STL and integrate this into cmake.

Alex
(0018989)
Alex Neundorf   
2009-12-23 12:56   
Clinton, do you want to work on this ?
I'd say we should try to integrate automoc4 from KDE (http://websvn.kde.org/trunk/kdesupport/automoc/ [^] , http://techbase.kde.org/Development/Tools/Automoc4 [^] ) into cmake instead. Then we can do much more.

Alex
(0036165)
Clinton Stimpson   
2014-06-12 08:42   
Thanks! Can you also make a test for this?
(0036545)
Clinton Stimpson   
2014-08-04 11:07   
Committed. Thanks.
http://cmake.org/gitweb?p=cmake.git;a=commit;h=6e576ba [^]
(0036546)
Clinton Stimpson   
2014-08-04 11:10   
Actually, this is the correct one, which fixes the attribution.
http://cmake.org/gitweb?p=cmake.git;a=commit;h=cf4a7eb [^]
(0036552)
Clinton Stimpson   
2014-08-05 09:48   
Reopening because the testing still needs work, and the commits were reverted.

Feedback from Stephen Kelly:
Your topic changes the Qt4And5Automoc test in an undesirable way. The
point of the test is to run when both are available.

I recommend you create a new unit test for your feature and consider this:

cmake{master}$ git grep QT_TEST_VERSION Tests/
Tests/CMakeLists.txt:
-DQT_QMAKE_EXECUTABLE:FILEPATH=${QT_QMAKE_EXECUTABLE} -DQT_TEST_VERSION=5
Tests/CMakeLists.txt:
-DQT_QMAKE_EXECUTABLE:FILEPATH=${QT_QMAKE_EXECUTABLE} -DQT_TEST_VERSION=5
Tests/CMakeLists.txt:
-DQT_QMAKE_EXECUTABLE:FILEPATH=${QT_QMAKE_EXECUTABLE} -DQT_TEST_VERSION=4
Tests/CMakeLists.txt:
-DQT_QMAKE_EXECUTABLE:FILEPATH=${QT_QMAKE_EXECUTABLE} -DQT_TEST_VERSION=4
Tests/QtAutoUicInterface/CMakeLists.txt:if (QT_TEST_VERSION STREQUAL 4)
Tests/QtAutoUicInterface/CMakeLists.txt: if (NOT QT_TEST_VERSION
STREQUAL 5)
Tests/QtAutogen/CMakeLists.txt:if (QT_TEST_VERSION STREQUAL 4)
Tests/QtAutogen/CMakeLists.txt: if (NOT QT_TEST_VERSION STREQUAL 5)



and after I modified the test to require both Qt4 and Qt5 he says:
Wouldn't it make more sense to extend the QtAutomoc test instead? That
is for testing QtAutomoc generally while Qt4And5Automoc is specifically
about testing in the presence of both Qt 4 and 5. Your patch dilutes
that test to also do more-general testing. Wouldn't it make more sense
to extend the QtAutomoc test instead?

Thanks,
Steve.
(0036554)
Clinton Stimpson   
2014-08-05 10:57   
Actually, it makes sense to extend the "QtAutogen" test, not "QtAutomoc" which doesn't exist, or the "Qt4AndQt5Automoc" test.
(0036567)
Lode Leroy   
2014-08-07 04:38   
added patch with updated tests
(0041626)
Kitware Robot   
2016-06-10 14:27   
Resolving issue as `moved`.

This issue tracker is no longer used. Further discussion of this issue may take place in the current CMake Issues page linked in the banner at the top of this page.