kdesupport/qt-dbus/examples
Brad King
brad.king at kitware.com
Wed May 31 23:31:27 CEST 2006
Peter Kümmel wrote:
> Thiago Macieira wrote:
>
>>Peter Kümmel wrote:
>>
>>>build example/chat also on windows: fix dbusidl2cpp.exe usage with
>>>nmake. using the IDE is still broken because chatinterface.moc and
>>>chatmainwindow.h are not generated. this is baybe a cmake BUG.
>>
>>There are hardcoded rules to run uic and moc for those files.
>>FindQt4.cmake doesn't provide any uic-related macros.
>>
>
>
> I think it is a CMake bug of the Visual Studio 8 2005 generator,
> because the other generators have no problem.
> I have to add this patch to compile chat with the IDE:
>
> Index: examples/CMakeLists.txt
> ===================================================================
> --- examples/CMakeLists.txt (Revision 547079)
> +++ examples/CMakeLists.txt (Arbeitskopie)
> @@ -72,6 +72,12 @@
> chat.h
> chatadaptor.cpp
> )
> +if(MSVC_IDE)
> + SET_SOURCE_FILES_PROPERTIES(${CMAKE_CURRENT_BINARY_DIR}/chatmainwindow.h GENERATED)
> + SET_SOURCE_FILES_PROPERTIES(${CMAKE_CURRENT_BINARY_DIR}/chatsetnickname.h GENERATED)
> + SET_SOURCE_FILES_PROPERTIES(${CMAKE_CURRENT_BINARY_DIR}/chatinterface.moc GENERATED)
You shouldn't need the GENERATED property. That is automatically added
by ADD_CUSTOM_COMMAND because the files are outputs.
> + SET(chat_SRCS ${chat_SRCS} chatmainwindow.h chatsetnickname.h chatinterface.moc )
Adding the output of a custom command to the list of sources should be
enough to pull it in.
> +endif(MSVC_IDE)
> ADD_CUSTOM_COMMAND(OUTPUT chatmainwindow.h
> COMMAND ${QT_UIC_EXECUTABLE}
> ARGS -o chatmainwindow.h ${CMAKE_CURRENT_SOURCE_DIR}/chatmainwindow.ui
>
> Why must I do it by hand? Couldn't it be figured out by cmake?
CMake cannot know that chatmainwindow.h will be used in the chat target
unless you add it, just like any *source* file. It is different from
other *header* files because it is generated and does not exist initially.
> Can I apply this patch, even if it's a work around (around cmake or my limited cmake knowlege)
Please try it without the explicit GENERATED mark.
-Brad
More information about the Kde-buildsystem
mailing list