summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorSebastian Holtermann <sebholt@xwmw.org>2017-08-22 17:09:50 (GMT)
committerSebastian Holtermann <sebholt@xwmw.org>2017-08-22 17:10:31 (GMT)
commit13bb716f046e33d9dbd20ac2156deb0f677797d3 (patch)
tree0ee34ff60e8fe16a2c48cb6f138ea061b63e400e
parent727247c31629b12a3e3eca44462250e21c6a54c8 (diff)
downloadCMake-13bb716f046e33d9dbd20ac2156deb0f677797d3.zip
CMake-13bb716f046e33d9dbd20ac2156deb0f677797d3.tar.gz
CMake-13bb716f046e33d9dbd20ac2156deb0f677797d3.tar.bz2
Autogen: Fix and extend SKIP_AUTOMOC test
-rw-r--r--Tests/QtAutogen/CMakeLists.txt15
-rw-r--r--Tests/QtAutogen/skipMoc.cpp6
-rw-r--r--Tests/QtAutogen/skipSource/qItemC.cpp12
-rw-r--r--Tests/QtAutogen/skipSource/qItemD.cpp17
-rw-r--r--Tests/QtAutogen/skipSource/qItemD.hpp13
5 files changed, 59 insertions, 4 deletions
diff --git a/Tests/QtAutogen/CMakeLists.txt b/Tests/QtAutogen/CMakeLists.txt
index be864c3..81ab734 100644
--- a/Tests/QtAutogen/CMakeLists.txt
+++ b/Tests/QtAutogen/CMakeLists.txt
@@ -114,16 +114,27 @@ target_compile_features(empty PRIVATE ${QT_COMPILE_FEATURES})
# -- Test
# Test for SKIP_AUTOMOC and SKIP_AUTOGEN on an AUTOMOC enabled target
if(ALLOW_WRAP_CPP)
+ # Generate header mocs manually
qtx_wrap_cpp(skipMocWrapMoc
skipSource/qItemA.hpp
- skipSource/qItemB.hpp)
+ skipSource/qItemB.hpp
+ skipSource/qItemC.hpp
+ skipSource/qItemD.hpp
+ )
set(skipMocSources
skipMoc.cpp
skipSource/qItemA.cpp
skipSource/qItemB.cpp
- skipSource/qItemC.cpp)
+ skipSource/qItemC.cpp
+ skipSource/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 skipSource/qItemA.cpp PROPERTY SKIP_AUTOMOC ON)
set_property(SOURCE skipSource/qItemB.cpp PROPERTY SKIP_AUTOGEN ON)
+ # When hpp files are skipped, the cpp still get processed.
+ set_property(SOURCE skipSource/qItemC.hpp PROPERTY SKIP_AUTOMOC ON)
+ set_property(SOURCE skipSource/qItemD.hpp PROPERTY SKIP_AUTOGEN ON)
# AUTOMOC enabled only
add_executable(skipMocA ${skipMocSources} ${skipMocWrapMoc})
set_property(TARGET skipMocA PROPERTY AUTOMOC ON)
diff --git a/Tests/QtAutogen/skipMoc.cpp b/Tests/QtAutogen/skipMoc.cpp
index 85305f5..d6b292f 100644
--- a/Tests/QtAutogen/skipMoc.cpp
+++ b/Tests/QtAutogen/skipMoc.cpp
@@ -2,12 +2,14 @@
#include "skipSource/qItemA.hpp"
#include "skipSource/qItemB.hpp"
#include "skipSource/qItemC.hpp"
+#include "skipSource/qItemD.hpp"
int main(int, char**)
{
QItemA itemA;
- QItemA itemB;
- QItemA itemC;
+ QItemB itemB;
+ QItemC itemC;
+ QItemD itemD;
// Fails to link if the symbol is not present.
return 0;
diff --git a/Tests/QtAutogen/skipSource/qItemC.cpp b/Tests/QtAutogen/skipSource/qItemC.cpp
index 700abd6..622f282 100644
--- a/Tests/QtAutogen/skipSource/qItemC.cpp
+++ b/Tests/QtAutogen/skipSource/qItemC.cpp
@@ -1,5 +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/skipSource/qItemD.cpp b/Tests/QtAutogen/skipSource/qItemD.cpp
new file mode 100644
index 0000000..fe0f4e4
--- /dev/null
+++ b/Tests/QtAutogen/skipSource/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/skipSource/qItemD.hpp b/Tests/QtAutogen/skipSource/qItemD.hpp
new file mode 100644
index 0000000..99e0acb
--- /dev/null
+++ b/Tests/QtAutogen/skipSource/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