Hi, today I learned that qmake apparently can work with #included moc files but only if they are of the form moc_<name>.cpp. But KDE4_AUTOMOC wants them as <name>.moc.
In order to make it easier to switch from qmake to cmake (and back) I suggest the attached patch. There's one issue I don't understand yet: Why are the *.moc files (and with my patch the moc_*.cpp files) added to add_library/add_executable? If they're compiled twice, linking obviously fails. Is it necessary to add a dependency? I disabled it for KDE4_ADD_LIBRARY in order to be able to test it with libphonon, and I have not seen any problems yet while compiling kdelibs. Please CC me as I'm not subscribed to this list. -- ________________________________________________________ Matthias Kretz (Germany) <>< http://Vir.homelinux.org/ [EMAIL PROTECTED], [EMAIL PROTECTED], [EMAIL PROTECTED]
Index: KDE4Macros.cmake
===================================================================
--- KDE4Macros.cmake (revision 671744)
+++ KDE4Macros.cmake (working copy)
@@ -173,11 +173,18 @@
file(READ ${_abs_FILE} _contents)
get_filename_component(_abs_PATH ${_abs_FILE} PATH)
- 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}")
- get_filename_component(_basename ${_current_MOC} NAME_WE)
+ 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)
+
set(_header ${_abs_PATH}/${_basename}.h)
set(_moc ${CMAKE_CURRENT_BINARY_DIR}/${_current_MOC})
@@ -843,9 +850,9 @@
if (KDE4_ENABLE_FINAL)
kde4_create_final_files(${CMAKE_CURRENT_BINARY_DIR}/${_target_NAME}_final_cpp.cpp _separate_files ${_first_SRC} ${ARGN})
- add_library(${_target_NAME} ${_add_lib_param} ${CMAKE_CURRENT_BINARY_DIR}/${_target_NAME}_final_cpp.cpp ${_separate_files} ${_automoc_FILES})
+ add_library(${_target_NAME} ${_add_lib_param} ${CMAKE_CURRENT_BINARY_DIR}/${_target_NAME}_final_cpp.cpp ${_separate_files}) # ${_automoc_FILES})
else (KDE4_ENABLE_FINAL)
- add_library(${_target_NAME} ${_add_lib_param} ${_first_SRC} ${ARGN} ${_automoc_FILES})
+ add_library(${_target_NAME} ${_add_lib_param} ${_first_SRC} ${ARGN}) # ${_automoc_FILES})
endif (KDE4_ENABLE_FINAL)
kde4_handle_rpath_for_library(${_target_NAME})
pgpbcphuvjf30.pgp
Description: PGP signature
_______________________________________________ Kde-buildsystem mailing list [email protected] https://mail.kde.org/mailman/listinfo/kde-buildsystem
