moc files not generated in kdewidgets anymore

David Faure faure at kde.org
Thu Jun 14 12:45:03 UTC 2012


In the frameworks branch of kdelibs, cmake is not creating the moc files in kdewidgets/ anymore.

Testcase: build kdelibs-frameworks (qt4, full build) from scratch, or just delete the moc files in your existing build.

Error message:

[100%] Automoc for target kdewidgets
[100%] Built target kdewidgets_automoc
[100%] Generating kdewidgets.cpp
[100%] Building CXX object kdewidgets/CMakeFiles/kdewidgets.dir/kdewidgets.cpp.o
/d/kde/build/5/kdelibs-frameworks/kdewidgets/kdewidgets.cpp:2584:71: fatal error: /d/kde/build/5/kdelibs-frameworks/kdewidgets/kdewidgets.moc: No such file or directory


CMakeLists.txt extract:

  # get the name of the generated wrapper script (which sets up LD_LIBRARY_PATH)
  get_target_property(MAKEKDEWIDGETS_EXECUTABLE makekdewidgets WRAPPER_SCRIPT)

  add_custom_command(OUTPUT ${CMAKE_CURRENT_BINARY_DIR}/kdewidgets.cpp
    COMMAND "${MAKEKDEWIDGETS_EXECUTABLE}" -o ${CMAKE_CURRENT_BINARY_DIR}/kdewidgets.cpp ${CMAKE_CURRENT_SOURCE_DIR}/kde.widgets
    MAIN_DEPENDENCY kde.widgets DEPENDS makekdewidgets)

  set(kdewidgets_PART_SRCS
     classpreviews.cpp
     ${CMAKE_CURRENT_BINARY_DIR}/kdewidgets.cpp
  )

  qt4_generate_moc(${CMAKE_CURRENT_BINARY_DIR}/kdewidgets.cpp ${CMAKE_CURRENT_BINARY_DIR}/kdewidgets.moc)

Possible fix:
 adding the moc file for the list of sources, to force it to be generated, seems to work. Shall I do that?

--- a/kdewidgets/CMakeLists.txt
+++ b/kdewidgets/CMakeLists.txt
@@ -44,6 +44,7 @@ if(QT_QTDESIGNER_FOUND)
   set(kdewidgets_PART_SRCS
      classpreviews.cpp
      ${CMAKE_CURRENT_BINARY_DIR}/kdewidgets.cpp
+     ${CMAKE_CURRENT_BINARY_DIR}/kdewidgets.moc
   )
 
   qt4_generate_moc(${CMAKE_CURRENT_BINARY_DIR}/kdewidgets.cpp ${CMAKE_CURRENT_BINARY_DIR}/kdewidgets.moc)


-- 
David Faure, faure at kde.org, http://www.davidfaure.fr
Sponsored by Nokia to work on KDE, incl. KDE Frameworks 5



More information about the Kde-buildsystem mailing list