diff options
author | Sebastian Holtermann <sebholt@xwmw.org> | 2017-12-08 17:24:52 (GMT) |
---|---|---|
committer | Sebastian Holtermann <sebholt@xwmw.org> | 2017-12-13 12:48:28 (GMT) |
commit | 0af9da29e487f0a6c60c379f0773a68b40ce2625 (patch) | |
tree | 1183f13f668dca872829610a02fdde54c6f65803 /Tests/QtAutogen/MocSkipSource | |
parent | f658bdaa7c7899a46caf402d4114999019897d46 (diff) | |
download | CMake-0af9da29e487f0a6c60c379f0773a68b40ce2625.zip CMake-0af9da29e487f0a6c60c379f0773a68b40ce2625.tar.gz CMake-0af9da29e487f0a6c60c379f0773a68b40ce2625.tar.bz2 |
Autogen: Tests: Separate MocSkipSource test
Diffstat (limited to 'Tests/QtAutogen/MocSkipSource')
-rw-r--r-- | Tests/QtAutogen/MocSkipSource/CMakeLists.txt | 36 | ||||
-rw-r--r-- | Tests/QtAutogen/MocSkipSource/qItemA.cpp | 5 | ||||
-rw-r--r-- | Tests/QtAutogen/MocSkipSource/qItemA.hpp | 13 | ||||
-rw-r--r-- | Tests/QtAutogen/MocSkipSource/qItemB.cpp | 5 | ||||
-rw-r--r-- | Tests/QtAutogen/MocSkipSource/qItemB.hpp | 13 | ||||
-rw-r--r-- | Tests/QtAutogen/MocSkipSource/qItemC.cpp | 17 | ||||
-rw-r--r-- | Tests/QtAutogen/MocSkipSource/qItemC.hpp | 13 | ||||
-rw-r--r-- | Tests/QtAutogen/MocSkipSource/qItemD.cpp | 17 | ||||
-rw-r--r-- | Tests/QtAutogen/MocSkipSource/qItemD.hpp | 13 | ||||
-rw-r--r-- | Tests/QtAutogen/MocSkipSource/skipMoc.cpp | 16 |
10 files changed, 148 insertions, 0 deletions
diff --git a/Tests/QtAutogen/MocSkipSource/CMakeLists.txt b/Tests/QtAutogen/MocSkipSource/CMakeLists.txt new file mode 100644 index 0000000..8d1fa6a --- /dev/null +++ b/Tests/QtAutogen/MocSkipSource/CMakeLists.txt @@ -0,0 +1,36 @@ +cmake_minimum_required(VERSION 3.10) +project(MocSkipSource) +include("../AutogenTest.cmake") + +# Test for SKIP_AUTOMOC and SKIP_AUTOGEN on an AUTOMOC enabled target + +# Generate header mocs manually +qtx_wrap_cpp(skipMocWrapMoc + qItemA.hpp + qItemB.hpp + qItemC.hpp + qItemD.hpp +) +set(skipMocSources + skipMoc.cpp + qItemA.cpp + qItemB.cpp + qItemC.cpp + qItemD.cpp +) +# When cpp files are skipped, the hpp won't be processed either, +# unless they are mentioned in the sources - which they aren't. +set_property(SOURCE qItemA.cpp PROPERTY SKIP_AUTOMOC ON) +set_property(SOURCE qItemB.cpp PROPERTY SKIP_AUTOGEN ON) +# When hpp files are skipped, the cpp still get processed. +set_property(SOURCE qItemC.hpp PROPERTY SKIP_AUTOMOC ON) +set_property(SOURCE qItemD.hpp PROPERTY SKIP_AUTOGEN ON) +# AUTOMOC enabled only +add_executable(skipMocA ${skipMocSources} ${skipMocWrapMoc}) +set_property(TARGET skipMocA PROPERTY AUTOMOC ON) +target_link_libraries(skipMocA ${QT_LIBRARIES}) +# AUTOMOC and AUTOUIC enabled +add_executable(skipMocB ${skipMocSources} ${skipMocWrapMoc}) +set_property(TARGET skipMocB PROPERTY AUTOMOC ON) +set_property(TARGET skipMocB PROPERTY AUTOUIC ON) +target_link_libraries(skipMocB ${QT_LIBRARIES}) diff --git a/Tests/QtAutogen/MocSkipSource/qItemA.cpp b/Tests/QtAutogen/MocSkipSource/qItemA.cpp new file mode 100644 index 0000000..522c2c7 --- /dev/null +++ b/Tests/QtAutogen/MocSkipSource/qItemA.cpp @@ -0,0 +1,5 @@ +#include "qItemA.hpp" + +void QItemA::go() +{ +} diff --git a/Tests/QtAutogen/MocSkipSource/qItemA.hpp b/Tests/QtAutogen/MocSkipSource/qItemA.hpp new file mode 100644 index 0000000..d295faf --- /dev/null +++ b/Tests/QtAutogen/MocSkipSource/qItemA.hpp @@ -0,0 +1,13 @@ +#ifndef QITEMA_HPP +#define QITEMA_HPP + +#include <QObject> + +class QItemA : public QObject +{ + Q_OBJECT + Q_SLOT + void go(); +}; + +#endif diff --git a/Tests/QtAutogen/MocSkipSource/qItemB.cpp b/Tests/QtAutogen/MocSkipSource/qItemB.cpp new file mode 100644 index 0000000..636e15d --- /dev/null +++ b/Tests/QtAutogen/MocSkipSource/qItemB.cpp @@ -0,0 +1,5 @@ +#include "qItemB.hpp" + +void QItemB::go() +{ +} diff --git a/Tests/QtAutogen/MocSkipSource/qItemB.hpp b/Tests/QtAutogen/MocSkipSource/qItemB.hpp new file mode 100644 index 0000000..1775915 --- /dev/null +++ b/Tests/QtAutogen/MocSkipSource/qItemB.hpp @@ -0,0 +1,13 @@ +#ifndef QITEMB_HPP +#define QITEMB_HPP + +#include <QObject> + +class QItemB : public QObject +{ + Q_OBJECT + Q_SLOT + void go(); +}; + +#endif diff --git a/Tests/QtAutogen/MocSkipSource/qItemC.cpp b/Tests/QtAutogen/MocSkipSource/qItemC.cpp new file mode 100644 index 0000000..622f282 --- /dev/null +++ b/Tests/QtAutogen/MocSkipSource/qItemC.cpp @@ -0,0 +1,17 @@ +#include "qItemC.hpp" + +class QItemC_Local : public QObject +{ + Q_OBJECT +public: + QItemC_Local(){}; + ~QItemC_Local(){}; +}; + +void QItemC::go() +{ + QItemC_Local localObject; +} + +// We need AUTOMOC processing +#include "qItemC.moc" diff --git a/Tests/QtAutogen/MocSkipSource/qItemC.hpp b/Tests/QtAutogen/MocSkipSource/qItemC.hpp new file mode 100644 index 0000000..f06bda2 --- /dev/null +++ b/Tests/QtAutogen/MocSkipSource/qItemC.hpp @@ -0,0 +1,13 @@ +#ifndef QITEMC_HPP +#define QITEMC_HPP + +#include <QObject> + +class QItemC : public QObject +{ + Q_OBJECT + Q_SLOT + void go(); +}; + +#endif diff --git a/Tests/QtAutogen/MocSkipSource/qItemD.cpp b/Tests/QtAutogen/MocSkipSource/qItemD.cpp new file mode 100644 index 0000000..fe0f4e4 --- /dev/null +++ b/Tests/QtAutogen/MocSkipSource/qItemD.cpp @@ -0,0 +1,17 @@ +#include "qItemD.hpp" + +class QItemD_Local : public QObject +{ + Q_OBJECT +public: + QItemD_Local(){}; + ~QItemD_Local(){}; +}; + +void QItemD::go() +{ + QItemD_Local localObject; +} + +// We need AUTOMOC processing +#include "qItemD.moc" diff --git a/Tests/QtAutogen/MocSkipSource/qItemD.hpp b/Tests/QtAutogen/MocSkipSource/qItemD.hpp new file mode 100644 index 0000000..99e0acb --- /dev/null +++ b/Tests/QtAutogen/MocSkipSource/qItemD.hpp @@ -0,0 +1,13 @@ +#ifndef QITEMD_HPP +#define QITEMD_HPP + +#include <QObject> + +class QItemD : public QObject +{ + Q_OBJECT + Q_SLOT + void go(); +}; + +#endif diff --git a/Tests/QtAutogen/MocSkipSource/skipMoc.cpp b/Tests/QtAutogen/MocSkipSource/skipMoc.cpp new file mode 100644 index 0000000..c915334 --- /dev/null +++ b/Tests/QtAutogen/MocSkipSource/skipMoc.cpp @@ -0,0 +1,16 @@ + +#include "qItemA.hpp" +#include "qItemB.hpp" +#include "qItemC.hpp" +#include "qItemD.hpp" + +int main(int, char**) +{ + QItemA itemA; + QItemB itemB; + QItemC itemC; + QItemD itemD; + + // Fails to link if the symbol is not present. + return 0; +} |