On Tuesday 12 June 2007, Alexander Neundorf wrote: > Hi, > > On Saturday 09 June 2007 05:20, Matthias Kretz wrote: > > On Saturday 09 June 2007, Alexander Neundorf wrote: > > > On Friday 08 June 2007 05:07, Matthias Kretz wrote: > > > > On Friday 08 June 2007, Alexander Neundorf wrote: > > > > > Using OBJECT_DEPENDS works more or less, but not 100%. > > > > > > > > > :( Is this a bug in cmake or is it some corner case that > > > > > > > > add_library/add_executable works around? > > > > > > > > > IOW we have to stay with a non-source-file extension. > > > > > > > > How about the attached patch? It creates a new top-level target that > > > > depends on all moc custom commands and the library/executable target > > > > then depends on that moc target. > > > > I tried it with a clean kdelibs build and it created _all_ moc files > > > > before it started any compile job. I'm not sure why cmake/make does > > > > that but it's not really wrong either. > > > > > > > > A variation of the patch could be to check for .cpp files in > > > > _automoc_FILES and only then add this additional top-level target. > > > > Else do the same as before. > > > > > > I still have a patch here which moves the automoc test from cmake-time > > > to build time (i.e. faster cmake run) > > > This and your patch might fit together. > > > I have to get it up-to-date and then we can see whether they work > > > together. Please don't commit before. > > > > OK, then I'll revert my local moc include changes in phonon - otherwise I > > can't work on it anymore... The reason why I'd like to have it working > > soon is that Trolltech wants to be able to compile phonon using qmake > > (makes it easier for them to work on Windows and MacOS). > > attached you can find a modified KDE4Macros.cmake. > It creates for every target a automoc target, which executes an external > cmake script (kde4automoc.cmake), which does the actual parsing. > It seems to work here for me for kdelibs. > > In kde4automoc.cmake it should be easy to also search for moc_*.cpp files.
Yep. That was easy. :-) Patch attached. > Please give it a try and see how it works. So far it's been working great. I especially like that I don't have to rerun cmake when something automoc related changes and the CMakeLists.txt files don't change (e.g. if you forgot to #include the moc file). There are many STATUS messages, but I guess you'll comment those out before committing to trunk? -- ________________________________________________________ Matthias Kretz (Germany) <>< http://Vir.homelinux.org/ [EMAIL PROTECTED], [EMAIL PROTECTED], [EMAIL PROTECTED]
Index: kde4automoc.cmake
===================================================================
--- kde4automoc.cmake (revision 675396)
+++ kde4automoc.cmake (working copy)
@@ -18,23 +18,28 @@
set(_mocs_PER_FILE)
- string(REGEX MATCHALL "#include +[^ ]+\\.moc[\">]" _match "${_contents}")
+ string(REGEX MATCHALL "#include +([\"<]moc_[^ ]+\\.cpp|[^ ]+\\.moc)[\">]" _match "${_contents}")
if (_match)
foreach (_current_MOC_INC ${_match})
string(REGEX MATCH "[^ <\"]+\\.moc" _current_MOC "${_current_MOC_INC}")
+ if(_current_MOC)
+ get_filename_component(_basename ${_current_MOC} NAME_WE)
+ else(_current_MOC)
+ string(REGEX MATCH "moc_[^ <\"]+\\.cpp" _current_MOC "${_current_MOC_INC}")
+ get_filename_component(_basename ${_current_MOC} NAME_WE)
+ string(REPLACE "moc_" "" _basename "${_basename}")
+ endif(_current_MOC)
- get_filename_component(_basename ${_current_MOC} NAME_WE)
set(_header ${_abs_PATH}/${_basename}.h)
set(_moc ${KDE4_CURRENT_BINARY_DIR}/${_current_MOC})
+ if (NOT EXISTS ${_header})
+ message(FATAL_ERROR "In the file \"${_filename}\" the moc file \"${_current_MOC}\" is included, but \"${_header}\" doesn't exist.")
+ endif (NOT EXISTS ${_header})
+
list(APPEND _mocs_PER_FILE ${_basename})
file(APPEND ${_moc_mark_FILE} "set( ${_basename}_MOC ${_moc})\n")
file(APPEND ${_moc_mark_FILE} "set( ${_basename}_HEADER ${_header})\n")
-
- if (NOT EXISTS ${_abs_PATH}/${_basename}.h)
- message(FATAL_ERROR "In the file \"${_filename}\" the moc file \"${_current_MOC}\" is included, but \"${_abs_PATH}/${_basename}.h\" doesn't exist.")
- endif (NOT EXISTS ${_abs_PATH}/${_basename}.h)
-
endforeach (_current_MOC_INC)
endif (_match)
file(APPEND ${_moc_mark_FILE} "set(mocs ${_mocs_PER_FILE})\n")
pgpbqwEuaibgW.pgp
Description: PGP signature
_______________________________________________ Kde-buildsystem mailing list [email protected] https://mail.kde.org/mailman/listinfo/kde-buildsystem
