On vendredi 30 juin 2017 15:28:50 CEST Sebastian Holtermann wrote: > Hi David. > > >> I think the trouble comes from mixing AUTOMOC with qt5_generate_moc. The > >> moc file is generated twice > >> > >> 1. By AUTOMOC: > >> /d/kde/build/5/frameworks/kconfig/autotests/kconfig_compiler/test_signal_ > >> aut ogen/EJRQKI7XPS/moc_test_signal.cpp > >> > >> 2. By qt5_generate_moc: > >> /d/kde/build/5/frameworks/kconfig/autotests/kconfig_compiler/test_signal. > >> moc> > > The code says: > > qt5_generate_moc(${_header_FILE} ${_moc_FILE}) > > > > set_property(SOURCE ${_src_FILE} PROPERTY SKIP_AUTOMOC TRUE) # don't > > run automoc on this file> > > so it souds like SKIP_AUTOMOC is broken? > > > >> Does this happen with CMake 3.8.2 as well? > > > > It all builds fine with CMake 3.8.2, I just retried. > > Meanwhile I was able to reproduce the issue. > At first I thought SKIP_AUTOMOC was broken, too, > but I could not find a serious flaw there. > > I think the problem is that CMake 3.9 supports AUTOMOC on GENERATED > files for the first time. > Some headers in the KDE test cases *are* GENERATED and therefore used > to be ignored by AUTOMOC - until now. > A solution on the KDE side might be to enable SKIP_AUTOMOC on the > respective headers. > > Well, the attached patch fixes the issue on my system.
Thanks, I have pushed the patch for KConfig. For the record, any use of QT5_ADD_DBUS_INTERFACE or QT5_ADD_DBUS_ADAPTOR also leads to double-definitions of moc classes, I submitted a fix for Qt at https://codereview.qt-project.org/199038 I hope cmake 3.9 doesn't get released too fast... -- David Faure, fa...@kde.org, http://www.davidfaure.fr Working on KDE Frameworks 5
>From abee914c554aadfc13e796cd210ee6819e661445 Mon Sep 17 00:00:00 2001 From: Sebastian Holtermann <sebh...@xwmw.org> Date: Fri, 30 Jun 2017 15:25:15 +0200 Subject: [PATCH] Fix for CMake 3.9 --- KF5ConfigMacros.cmake | 1 + 1 file changed, 1 insertion(+) diff --git a/KF5ConfigMacros.cmake b/KF5ConfigMacros.cmake index f365c78..527054d 100644 --- a/KF5ConfigMacros.cmake +++ b/KF5ConfigMacros.cmake @@ -98,6 +98,7 @@ function (KCONFIG_ADD_KCFG_FILES _sources ) if(ARG_GENERATE_MOC) list(APPEND sources ${_moc_FILE}) qt5_generate_moc(${_header_FILE} ${_moc_FILE}) + set_property(SOURCE ${_header_FILE} PROPERTY SKIP_AUTOMOC TRUE) # don't run automoc on this file set_property(SOURCE ${_src_FILE} PROPERTY SKIP_AUTOMOC TRUE) # don't run automoc on this file set_property(SOURCE ${_src_FILE} APPEND PROPERTY OBJECT_DEPENDS ${_moc_FILE} ) endif() -- 2.11.0