mirror of
https://github.com/Kitware/CMake.git
synced 2026-08-08 16:50:48 +00:00
Autogen: Tests: Extend AUTOMOC include patterns test
This commit is contained in:
@@ -2,7 +2,14 @@ cmake_minimum_required(VERSION 3.10)
|
|||||||
project(MocOnly)
|
project(MocOnly)
|
||||||
include("../AutogenTest.cmake")
|
include("../AutogenTest.cmake")
|
||||||
|
|
||||||
# Test different Q_OBJECT position styles
|
add_executable(mocOnly
|
||||||
add_executable(mocOnly StyleA.cpp StyleB.cpp main.cpp)
|
main.cpp
|
||||||
|
# Test different Q_OBJECT position styles
|
||||||
|
StyleA.cpp
|
||||||
|
StyleB.cpp
|
||||||
|
# Test different moc_/.moc include positions
|
||||||
|
IncA.cpp
|
||||||
|
IncB.cpp
|
||||||
|
)
|
||||||
set_property(TARGET mocOnly PROPERTY AUTOMOC ON)
|
set_property(TARGET mocOnly PROPERTY AUTOMOC ON)
|
||||||
target_link_libraries(mocOnly ${QT_LIBRARIES})
|
target_link_libraries(mocOnly ${QT_LIBRARIES})
|
||||||
|
|||||||
19
Tests/QtAutogen/MocOnly/IncA.cpp
Normal file
19
Tests/QtAutogen/MocOnly/IncA.cpp
Normal file
@@ -0,0 +1,19 @@
|
|||||||
|
#include "moc_IncA.cpp"
|
||||||
|
/// AUTOMOC moc_ include on the first line of the file!
|
||||||
|
#include "IncA.hpp"
|
||||||
|
|
||||||
|
/// @brief Source local QObject
|
||||||
|
///
|
||||||
|
class IncAPrivate : public QObject
|
||||||
|
{
|
||||||
|
Q_OBJECT
|
||||||
|
public:
|
||||||
|
IncAPrivate(){};
|
||||||
|
};
|
||||||
|
|
||||||
|
IncA::IncA()
|
||||||
|
{
|
||||||
|
IncAPrivate priv;
|
||||||
|
}
|
||||||
|
|
||||||
|
#include "IncA.moc"
|
||||||
15
Tests/QtAutogen/MocOnly/IncA.hpp
Normal file
15
Tests/QtAutogen/MocOnly/IncA.hpp
Normal file
@@ -0,0 +1,15 @@
|
|||||||
|
#ifndef INCA_HPP
|
||||||
|
#define INCA_HPP
|
||||||
|
|
||||||
|
#include <QObject>
|
||||||
|
|
||||||
|
/// @brief Test moc include pattern in the source file
|
||||||
|
///
|
||||||
|
class IncA : public QObject
|
||||||
|
{
|
||||||
|
Q_OBJECT
|
||||||
|
public:
|
||||||
|
IncA();
|
||||||
|
};
|
||||||
|
|
||||||
|
#endif
|
||||||
19
Tests/QtAutogen/MocOnly/IncB.cpp
Normal file
19
Tests/QtAutogen/MocOnly/IncB.cpp
Normal file
@@ -0,0 +1,19 @@
|
|||||||
|
#include "IncB.hpp"
|
||||||
|
|
||||||
|
/// @brief Source local QObject
|
||||||
|
///
|
||||||
|
class IncBPrivate : public QObject
|
||||||
|
{
|
||||||
|
Q_OBJECT
|
||||||
|
public:
|
||||||
|
IncBPrivate(){};
|
||||||
|
};
|
||||||
|
|
||||||
|
IncB::IncB()
|
||||||
|
{
|
||||||
|
IncBPrivate priv;
|
||||||
|
}
|
||||||
|
|
||||||
|
/// AUTOMOC moc_ include on the last line of the file!
|
||||||
|
#include "IncB.moc"
|
||||||
|
#include "moc_IncB.cpp"
|
||||||
15
Tests/QtAutogen/MocOnly/IncB.hpp
Normal file
15
Tests/QtAutogen/MocOnly/IncB.hpp
Normal file
@@ -0,0 +1,15 @@
|
|||||||
|
#ifndef INCB_HPP
|
||||||
|
#define INCB_HPP
|
||||||
|
|
||||||
|
#include <QObject>
|
||||||
|
|
||||||
|
/// @brief Test moc include pattern in the source file
|
||||||
|
///
|
||||||
|
class IncB : public QObject
|
||||||
|
{
|
||||||
|
Q_OBJECT
|
||||||
|
public:
|
||||||
|
IncB();
|
||||||
|
};
|
||||||
|
|
||||||
|
#endif
|
||||||
@@ -1,3 +1,5 @@
|
|||||||
|
#include "IncA.hpp"
|
||||||
|
#include "IncB.hpp"
|
||||||
#include "StyleA.hpp"
|
#include "StyleA.hpp"
|
||||||
#include "StyleB.hpp"
|
#include "StyleB.hpp"
|
||||||
|
|
||||||
@@ -5,5 +7,8 @@ int main(int argv, char** args)
|
|||||||
{
|
{
|
||||||
StyleA styleA;
|
StyleA styleA;
|
||||||
StyleB styleB;
|
StyleB styleB;
|
||||||
|
IncA incA;
|
||||||
|
IncB incB;
|
||||||
|
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user