Hi there, I applied my patch to kdelibs to use the INTERFACE_INCLUDE_DIRECTORIES of targets and remove include_directories() calls.
This resulted in a failure when moc'ing for dfaure: http://thread.gmane.org/gmane.comp.kde.devel.buildsystem/7778/focus=7779 In his system, he has Qt 4 headers in /usr/include, and a dependent package in /usr/include too. The Qt 5 moc is finding the headers there first because /usr/include is listed before the Qt 5 includes. This isn't a bug which will break existing buildsystems, but would be a common bug in all projects which applied a patch like mine to use the INTERFACE_INCLUDE_DIRECTORIES. So, here's a simplification of the bug he hit: set(somepackage_INCLUDE_DIRS /usr/include) # From a find_package find_package(Qt5Test) if (TRUE) # The order makes this work fine: include_directories(${Qt5Test_INCLUDE_DIRS}) include_directories(${somepackage_INCLUDE_DIRS}) else() # This would break: include_directories(${somepackage_INCLUDE_DIRS}) include_directories(${Qt5Test_INCLUDE_DIRS}) endif() add_executable(foo ...) target_link_libraries(foo Qt5::Test) After my patch was applied, we have this: include_directories(${somepackage_INCLUDE_DIRS}) add_executable(foo ...) target_link_libraries(foo Qt5::Test) and the Qt5::Test include dirs are added after the somepackage_INCLUDE_DIRS. For the compiler that's ok because we don't generate buildsystems with the default include paths explicitly listed, but for moc, those include paths are added to the command line. The problem is that they are added to the command line in the order that they were specified, so I get this: /home/stephen/dev/prefix/qtbase-stable/bin/moc -I/usr/include - I/home/stephen/dev/prefix/qtbase-stable/include/QtTest A recently applied patch to the stable branch of qmake adds the default include paths after the user-specified ones: https://codereview.qt-project.org/#change,51065 I recommend changing AUTOMOC to do the same appending. At some point, it seems that was done http://thread.gmane.org/gmane.comp.programming.tools.cmake.devel/5293/focus=5297 but a followup branch probably changed that to the current state. Comments? Thanks, Steve. The bug can be reproduced with this cpp file: #include <QtTest/QTest> // Make CMAKE_AUTOMOC run on this file. class MyObject : public QObject { Q_OBJECT explicit MyObject(QObject *parent = 0) { QSKIP("The QSKIP macro has two args in Qt4 and one in Qt5."); } }; #include "main.moc" -- Powered by www.kitware.com Visit other Kitware open-source projects at http://www.kitware.com/opensource/opensource.html Please keep messages on-topic and check the CMake FAQ at: http://www.cmake.org/Wiki/CMake_FAQ Follow this link to subscribe/unsubscribe: http://public.kitware.com/cgi-bin/mailman/listinfo/cmake-developers
