automoc: add a test for including both abc.moc and moc_abc.cpp

Alex
This commit is contained in:
Alex Neundorf 2011-11-22 19:13:03 +01:00
parent 72bb058e92
commit 80dfbc99f4
4 changed files with 74 additions and 1 deletions

View File

@ -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)

41
Tests/QtAutomoc/abc.cpp Normal file
View File

@ -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"

28
Tests/QtAutomoc/abc.h Normal file
View File

@ -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

View File

@ -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();
} }