Hi,everyone
I am new to cmake. I don't know how to write a CMakeList.txt file if
Q_OBJECT in a "xxx.cpp" source file.
for example,
A very simple qt4 program like this.
// filename main.cpp
#include
#include
class Widget:public QWidget
{
Q_OBJECT
public:
Widget(QWidget * parent=0):QWidge
PROJECT(mytest)
CMAKE_MINIMUM_REQUIRED(VERSION 2.6)
FIND_PACKAGE(Qt4 COMPONENTS QtCore QtGui REQUIRED)
INCLUDE(${QT_USE_FILE})
SET(pro_SOURCESmain.cpp)
QT4_WRAP_CPP( Generated_MOC_SRCS main.cpp )
INCLUDE_DIRECTORIES(${CMAKE_CURRENT_BINARY_DIR})
ADD_EXECUTABLE(mytest ${pro_SOURCES} ${Generat
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.
This works
> 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.
>
I am confused at the p
On Sat, Jul 31, 2010 at 10:50 AM, 1+1=2 wrote:
> I want to use command like this:
>
> QT4_GENERATE_MOC(${CMAKE_CURRENT_SOURCE_DIR}/main.cpp main.moc)
>
> but I do not know how to make this run before main.cpp being compiled to
> main.o
>
> anyone can help me?
>
Besides the fact that your syntax
On Sat, Jul 31, 2010 at 9:05 AM, 1+1=2 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_EXECUTABL
On Sat, Jul 31, 2010 at 11:28 AM, John Drescher wrote:
> On Sat, Jul 31, 2010 at 9:05 AM, 1+1=2 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"
>>
On Sat, Jul 31, 2010 at 11:28 PM, John Drescher wrote:
> On Sat, Jul 31, 2010 at 9:05 AM, 1+1=2 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"
>>
On Sat, Jul 31, 2010 at 11:45 AM, 1+1=2 wrote:
> On Sat, Jul 31, 2010 at 11:28 PM, John Drescher wrote:
>> On Sat, Jul 31, 2010 at 9:05 AM, 1+1=2 wrote:
>>> Thanks for your answer.
>>>
>>> when use QT4_WRAP_CPP( Generated_MOC_SRCS main.cpp ), moc_main.cxx
>>> will be generated.
>>> then I use #
Thanks for your advice. I just want the project to be able to work
under both cmake and qmake.
I found an answer, which seems to work now.
PROJECT(mytest)
CMAKE_MINIMUM_REQUIRED(VERSION 2.6)
FIND_PACKAGE(Qt4 COMPONENTS QtCore QtGui REQUIRED)
INCLUDE(${QT_USE_FILE})
SET(pro_SOURCES main.cpp)
QT
If you put main.moc in add_executable() then you don't have to use the
set_source_files_properties() to manually specify dependencies.
Clint
On 07/31/2010 10:11 AM, 1+1=2 wrote:
Thanks for your advice. I just want the project to be able to work
under both cmake and qmake.
I found an answer,
On Saturday 31 July 2010, Clinton Stimpson wrote:
> If you put main.moc in add_executable() then you don't have to use the
> set_source_files_properties() to manually specify dependencies.
Yes, but main.moc is already #included in main.cpp so it cannout be added to
add_executable.
In KDE we are
On Tuesday, August 03, 2010 02:07:31 pm Alexander Neundorf wrote:
> On Saturday 31 July 2010, Clinton Stimpson wrote:
> > If you put main.moc in add_executable() then you don't have to use the
> > set_source_files_properties() to manually specify dependencies.
>
> Yes, but main.moc is already #inc
On Wednesday 04 Aug 2010 1:49:36 am Clinton Stimpson wrote:
> On Tuesday, August 03, 2010 02:07:31 pm Alexander Neundorf wrote:
> > On Saturday 31 July 2010, Clinton Stimpson wrote:
> > > If you put main.moc in add_executable() then you don't have to use the
> > > set_source_files_properties() to m
14 matches
Mail list logo