automoc: add test for including the moc file from another header
including moc_xyz.cpp in abc.cpp should run moc on xyz.h (and include the file in abc.cpp) Alex
This commit is contained in:
parent
80dfbc99f4
commit
30fd8e603a
|
@ -13,7 +13,7 @@ add_definitions(-DFOO)
|
||||||
# create an executable and a library target, both requiring automoc:
|
# create an executable and a library target, both requiring automoc:
|
||||||
add_library(codeeditorLib STATIC codeeditor.cpp)
|
add_library(codeeditorLib STATIC codeeditor.cpp)
|
||||||
|
|
||||||
add_executable(foo main.cpp calwidget.cpp foo.cpp blub.cpp bar.cpp abc.cpp)
|
add_executable(foo main.cpp calwidget.cpp foo.cpp blub.cpp bar.cpp abc.cpp xyz.cpp)
|
||||||
|
|
||||||
set_target_properties(foo codeeditorLib PROPERTIES AUTOMOC TRUE)
|
set_target_properties(foo codeeditorLib PROPERTIES AUTOMOC TRUE)
|
||||||
|
|
||||||
|
|
|
@ -37,5 +37,9 @@ void Abc::doAbc()
|
||||||
pa.print();
|
pa.print();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// check that including the moc file for the cpp file and the header works:
|
||||||
#include "abc.moc"
|
#include "abc.moc"
|
||||||
#include "moc_abc.cpp"
|
#include "moc_abc.cpp"
|
||||||
|
|
||||||
|
// check that including a moc file from another header works:
|
||||||
|
#include "moc_xyz.cpp"
|
||||||
|
|
|
@ -46,6 +46,7 @@
|
||||||
#include "blub.h"
|
#include "blub.h"
|
||||||
#include "sub/bar.h"
|
#include "sub/bar.h"
|
||||||
#include "abc.h"
|
#include "abc.h"
|
||||||
|
#include "xyz.h"
|
||||||
|
|
||||||
int main(int argv, char **args)
|
int main(int argv, char **args)
|
||||||
{
|
{
|
||||||
|
@ -70,5 +71,8 @@ int main(int argv, char **args)
|
||||||
Abc abc;
|
Abc abc;
|
||||||
abc.doAbc();
|
abc.doAbc();
|
||||||
|
|
||||||
|
Xyz xyz;
|
||||||
|
xyz.doXyz();
|
||||||
|
|
||||||
return app.exec();
|
return app.exec();
|
||||||
}
|
}
|
||||||
|
|
|
@ -0,0 +1,28 @@
|
||||||
|
/*============================================================================
|
||||||
|
CMake - Cross Platform Makefile Generator
|
||||||
|
Copyright 2004-2011 Kitware, Inc.
|
||||||
|
Copyright 2011 Alexander Neundorf (neundorf@kde.org)
|
||||||
|
|
||||||
|
Distributed under the OSI-approved BSD License (the "License");
|
||||||
|
see accompanying file Copyright.txt for details.
|
||||||
|
|
||||||
|
This software is distributed WITHOUT ANY WARRANTY; without even the
|
||||||
|
implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
|
||||||
|
See the License for more information.
|
||||||
|
============================================================================*/
|
||||||
|
|
||||||
|
|
||||||
|
#include "xyz.h"
|
||||||
|
|
||||||
|
#include <stdio.h>
|
||||||
|
|
||||||
|
Xyz::Xyz()
|
||||||
|
:QObject()
|
||||||
|
{
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
void Xyz::doXyz()
|
||||||
|
{
|
||||||
|
printf("This is xyz !\n");
|
||||||
|
}
|
|
@ -0,0 +1,28 @@
|
||||||
|
/*============================================================================
|
||||||
|
CMake - Cross Platform Makefile Generator
|
||||||
|
Copyright 2004-2011 Kitware, Inc.
|
||||||
|
Copyright 2011 Alexander Neundorf (neundorf@kde.org)
|
||||||
|
|
||||||
|
Distributed under the OSI-approved BSD License (the "License");
|
||||||
|
see accompanying file Copyright.txt for details.
|
||||||
|
|
||||||
|
This software is distributed WITHOUT ANY WARRANTY; without even the
|
||||||
|
implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
|
||||||
|
See the License for more information.
|
||||||
|
============================================================================*/
|
||||||
|
|
||||||
|
#ifndef XYZ_H
|
||||||
|
#define XYZ_H
|
||||||
|
|
||||||
|
#include <QObject>
|
||||||
|
|
||||||
|
class Xyz : public QObject
|
||||||
|
{
|
||||||
|
Q_OBJECT
|
||||||
|
public:
|
||||||
|
Xyz();
|
||||||
|
public slots:
|
||||||
|
void doXyz();
|
||||||
|
};
|
||||||
|
|
||||||
|
#endif
|
Loading…
Reference in New Issue