Hi,

attached is a patch to automoc to let it pass all -D parameters that get 
passed to gcc/g++ also to moc.

I've been compiling with this patch applied for a few weeks now and it's 
working fine.

OK, to commit to kdesupport?

-- 
________________________________________________________
Matthias Kretz (Germany)                            <><
http://Vir.homelinux.org/
[EMAIL PROTECTED], [EMAIL PROTECTED],
[EMAIL PROTECTED]
Index: Automoc4Config.cmake
===================================================================
--- Automoc4Config.cmake	(revision 813013)
+++ Automoc4Config.cmake	(working copy)
@@ -70,8 +70,9 @@
    if(_moc_files)
       set(_automoc_source "${CMAKE_CURRENT_BINARY_DIR}/${_target_NAME}_automoc.cpp")
       get_directory_property(_moc_incs INCLUDE_DIRECTORIES)
+      get_directory_property(_moc_defs DEFINITIONS)
 
-      # configure_file replaces _moc_files and _moc_incs
+      # configure_file replaces _moc_files, _moc_incs and _moc_defs
       configure_file(${_AUTOMOC4_CURRENT_DIR}/automoc4.files.in ${_automoc_source}.files)
 
 #      add_custom_target(${_target_NAME}_automoc
Index: kde4automoc.cpp
===================================================================
--- kde4automoc.cpp	(revision 815717)
+++ kde4automoc.cpp	(working copy)
@@ -73,6 +73,7 @@
         QString builddir;
         QString mocExe;
         QStringList mocIncludes;
+        QStringList mocDefinitions;
         QStringList cmakeEchoColorArgs;
         QString cmakeExecutable;
         QFile dotFiles;
@@ -135,6 +136,17 @@
     cmakeExecutable = args[5];
 
     QByteArray line = dotFiles.readLine();
+    dotFilesCheck(line == "MOC_DEFINITIONS:\n");
+    line = dotFiles.readLine().trimmed();
+    const QStringList &defList = QString::fromUtf8(line).split(' ', QString::SkipEmptyParts);
+    foreach (const QString &def, defList) {
+        Q_ASSERT(!def.isEmpty());
+        if (def.startsWith(QLatin1String("-D"))) {
+            mocDefinitions << def;
+        }
+    }
+
+    line = dotFiles.readLine();
     dotFilesCheck(line == "MOC_INCLUDES:\n");
     line = dotFiles.readLine().trimmed();
     const QStringList &incPaths = QString::fromUtf8(line).split(';', QString::SkipEmptyParts);
@@ -503,7 +515,7 @@
 
         QProcess *mocProc = new QProcess;
         mocProc->setProcessChannelMode(QProcess::ForwardedChannels);
-        QStringList args(mocIncludes);
+        QStringList args(mocIncludes + mocDefinitions);
 #ifdef Q_OS_WIN
         args << "-DWIN32";
 #endif
Index: automoc4.files.in
===================================================================
--- automoc4.files.in	(revision 813013)
+++ automoc4.files.in	(working copy)
@@ -1,5 +1,7 @@
 SOURCES:
 @_moc_files@
+MOC_DEFINITIONS:
[EMAIL PROTECTED]@
 MOC_INCLUDES:
 @_moc_incs@
 CMAKE_INCLUDE_DIRECTORIES_PROJECT_BEFORE:

Attachment: signature.asc
Description: This is a digitally signed message part.

_______________________________________________
Kde-buildsystem mailing list
[email protected]
https://mail.kde.org/mailman/listinfo/kde-buildsystem

Reply via email to