Building kdelibs with VS 2005 (patch)

Manuel Klimek klimek at box4.net
Tue Oct 3 16:19:42 CEST 2006


Hi there,

I'm currently trying to compile kdelibs from the visual studio 2005
express gui. Most things went smoothly, but the kdeprint module
complained that it didn't find a symbol when linking. I found out that
the xml to dbus source file macros add the moc files to the source list
of the project. This is a problem with visual studio, because there
can't be two source files with the same name and different extensions -
they will match the same build rule:
kmfactoryinterface.cpp
kmfactoryinterface.moc
For both files visual studio tried to compile kmfactoryinterface.moc,
which is included in kmfactoryinterface.cpp anyways.

Now the moc files don't really need to be included in the source file
list, because they're included in the .cpp anyways (see patch).

If they shall be included (for easy access), they should be added
to the source file list in a way so that they're not automatically
compiled (this is handled by cmake, they could be called
"kmfactoryinterface_moc.inl" for example, because .inl files are not
compiled automatically)

I don't know if cmake 2.4.3 has a new mechanism for excluding files
in the source list from the build (?)
Anyways, the following patch fixes compilation for me with visual
studio by just not adding the moc files to the source file list.

Hope I could help a bit with this information.

cheers,
Manuel Klimek


Index: D:/build/kdelibs-src/cmake/modules/FindQt4.cmake
===================================================================
--- D:/build/kdelibs-src/cmake/modules/FindQt4.cmake	(revision 591822)
+++ D:/build/kdelibs-src/cmake/modules/FindQt4.cmake	(working copy)
@@ -858,7 +858,7 @@

     QT4_GENERATE_MOC(${_header} ${_moc})

-    SET(${_sources} ${${_sources}} ${_impl} ${_header} ${_moc})
+    SET(${_sources} ${${_sources}} ${_impl} ${_header})
     MACRO_ADD_FILE_DEPENDENCIES(${_impl} ${_moc})

   ENDMACRO(QT4_ADD_DBUS_INTERFACE)
@@ -921,7 +921,7 @@
     SET_SOURCE_FILES_PROPERTIES(${_impl} PROPERTIES SKIP_AUTOMOC TRUE)
     MACRO_ADD_FILE_DEPENDENCIES(${_impl} ${_moc})

-    SET(${_sources} ${${_sources}} ${_impl} ${_header} ${_moc})
+    SET(${_sources} ${${_sources}} ${_impl} ${_header})
   ENDMACRO(QT4_ADD_DBUS_ADAPTOR)

   MACRO(QT4_ADD_DBUS_ADAPTORS _sources)



More information about the Kde-windows mailing list