[CMake] How to write CMakeLists.txt for Qt4 when Q_OBJECT in xxx.cpp file

John Drescher drescherjm at gmail.com
Sat Jul 31 11:40:41 EDT 2010


On Sat, Jul 31, 2010 at 11:28 AM, John Drescher <drescherjm at gmail.com> wrote:
> On Sat, Jul 31, 2010 at 9:05 AM, 1+1=2 <dbzhang800 at gmail.com> wrote:
>> Thanks for your answer.
>>
>> when use QT4_WRAP_CPP( Generated_MOC_SRCS main.cpp ),  moc_main.cxx
>> will be generated.
>> then I use #include "moc_main.cxx" instead of #include "main.moc"
>>
>> but ${Generated_MOC_SRCS}  can not be added to  ADD_EXECUTABLE.
>> otherwise moc_main.cxx will be compiled too.
>>
> You want moc_main.cxx to be compiled otherwise you will have link errors.
>

Wait a minute. I think I did this a different way on one project. I
will try to dig this up later today. I am out to enjoy the weather for
now..

John


More information about the CMake mailing list