[Qt-interest] qt4 .moc .cpp

Gopalakrishna Bhat gopalakbhat at gmail.com
Mon Dec 13 05:08:02 CET 2010


Hi,

You might have a look at
http://lists.trolltech.com/pipermail/qt-interest/2010-September/027437.html

Specifically
http://lists.trolltech.com/pipermail/qt-interest/2010-September/027449.html

The thread also contains a link to the wiki of using cmake with qt.

With regards,
Gopalakrishna Bhat

On Sun, Dec 12, 2010 at 6:57 AM, sibu xolo <sibxol at btconnect.com> wrote:
> Greetings,
>
> I am  learning to  build a Qt4 application using cmake.  I have a machine with
> qt-4.6.2 and cmake-2.8.0.  The project has these:- fileZ.cpp, fileZ.h
>
> There is a macro QT4_WRAP_CPP() that runs the MOC and transform fileZ.h into
> a .cpp source file. However FileZ.cpp  is compiled into a  file with the .moc
> extension.
>
> There does not appear to be a ready made macro in cmake for this and I tried
> using   the add_custom_command() function of cmake like so:-
>
>
> configure_file(PATH/to/fileZ.cpp PATH/to/fileZ2.h @COPYONLY)
> set(MOC_cmd "/opt/qt4/bin/moc")
> set(PRePRCESSOR_STIRNG "xxxx yyy zzz")
>
>  ADD_CUSTOM_COMMAND(
>   OUTPUT -o ${CMAKE_BINARY_DIR}/path/to/fileZ.moc
>   COMMAND  ${MOC_cmd}
> -I${QT_INCLUDES}
> -I${CMAKE_SOURCE_DIR}/path/to
> -E${PRePRCESSOR_STIRNG}
> ${CMAKE_BINARY_DIR}/path/to/fileZ2.h
>   DEPENDS ${CMAKE_SOURCE_DIR}/path/to/fileZ.cpp )
>
> but (apart from the first line)  it did not work.
>
> I know this is a qt list but  many qt-ers are competent with cmake so
> suggestions
> (including if and how cmake handles .moc files etc) would be appreciated.
>
> sincerely
> SX
> _______________________________________________
> Qt-interest mailing list
> Qt-interest at trolltech.com
> http://lists.trolltech.com/mailman/listinfo/qt-interest
>



-- 
My blog http://gkbhat.blogspot.com




More information about the Qt-interest-old mailing list