automoc: add a test for including both abc.moc and moc_abc.cpp
Alex
This commit is contained in:
parent
72bb058e92
commit
80dfbc99f4
|
@ -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)
|
add_executable(foo main.cpp calwidget.cpp foo.cpp blub.cpp bar.cpp abc.cpp)
|
||||||
|
|
||||||
set_target_properties(foo codeeditorLib PROPERTIES AUTOMOC TRUE)
|
set_target_properties(foo codeeditorLib PROPERTIES AUTOMOC TRUE)
|
||||||
|
|
||||||
|
|
|
@ -0,0 +1,41 @@
|
||||||
|
/*============================================================================
|
||||||
|
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 "abc.h"
|
||||||
|
|
||||||
|
#include <stdio.h>
|
||||||
|
|
||||||
|
class PrintAbc : public QObject
|
||||||
|
{
|
||||||
|
Q_OBJECT
|
||||||
|
public:
|
||||||
|
PrintAbc():QObject() {}
|
||||||
|
public slots:
|
||||||
|
void print() const { printf("abc\n"); }
|
||||||
|
};
|
||||||
|
|
||||||
|
Abc::Abc()
|
||||||
|
:QObject()
|
||||||
|
{
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
void Abc::doAbc()
|
||||||
|
{
|
||||||
|
PrintAbc pa;
|
||||||
|
pa.print();
|
||||||
|
}
|
||||||
|
|
||||||
|
#include "abc.moc"
|
||||||
|
#include "moc_abc.cpp"
|
|
@ -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 ABC_H
|
||||||
|
#define ABC_H
|
||||||
|
|
||||||
|
#include <QObject>
|
||||||
|
|
||||||
|
class Abc : public QObject
|
||||||
|
{
|
||||||
|
Q_OBJECT
|
||||||
|
public:
|
||||||
|
Abc();
|
||||||
|
public slots:
|
||||||
|
void doAbc();
|
||||||
|
};
|
||||||
|
|
||||||
|
#endif
|
|
@ -45,6 +45,7 @@
|
||||||
#include "foo.h"
|
#include "foo.h"
|
||||||
#include "blub.h"
|
#include "blub.h"
|
||||||
#include "sub/bar.h"
|
#include "sub/bar.h"
|
||||||
|
#include "abc.h"
|
||||||
|
|
||||||
int main(int argv, char **args)
|
int main(int argv, char **args)
|
||||||
{
|
{
|
||||||
|
@ -66,5 +67,8 @@ int main(int argv, char **args)
|
||||||
Bar bar;
|
Bar bar;
|
||||||
bar.doBar();
|
bar.doBar();
|
||||||
|
|
||||||
|
Abc abc;
|
||||||
|
abc.doAbc();
|
||||||
|
|
||||||
return app.exec();
|
return app.exec();
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue