summaryrefslogtreecommitdiffstats
path: root/Tests
diff options
context:
space:
mode:
authorBrad King <brad.king@kitware.com>2023-06-01 15:19:02 (GMT)
committerKitware Robot <kwrobot@kitware.com>2023-06-01 15:19:19 (GMT)
commitf6435f799ea7aa6669b035fee2a0559040890d27 (patch)
treebbbf240c1da7f73bf0ab4380fa814c5fb592bb7b /Tests
parent99e80ea0ac2de2e0c24652c2af8589967996a0d4 (diff)
parent1f4b374d6e936960d902307bc9dcd4e8d93168e2 (diff)
downloadCMake-f6435f799ea7aa6669b035fee2a0559040890d27.zip
CMake-f6435f799ea7aa6669b035fee2a0559040890d27.tar.gz
CMake-f6435f799ea7aa6669b035fee2a0559040890d27.tar.bz2
Merge topic 'automoc-moc-options-test'
1f4b374d6e cmQtAutoGenInitializer: Reduce string copies b6f66b445a cmQtAutoGenInitializer: Remove no-op calls 55d93bdabf cmQtAutoGenInitializer: Improve const correctness feb56a666f cmTarget: Improve const correctness of AddUtility 5e513e562f Help: Add AUTOMOC_MOC_OPTIONS example 5380ad9d58 Tests: Add test for AUTOMOC_MOC_OPTIONS Acked-by: Kitware Robot <kwrobot@kitware.com> Merge-request: !8523
Diffstat (limited to 'Tests')
-rw-r--r--Tests/QtAutogen/MocOptions2/CMakeLists.txt10
-rw-r--r--Tests/QtAutogen/MocOptions2/main.cpp7
-rw-r--r--Tests/QtAutogen/MocOptions2/object.cpp5
-rw-r--r--Tests/QtAutogen/MocOptions2/object.hpp15
-rw-r--r--Tests/QtAutogen/Tests.cmake1
5 files changed, 38 insertions, 0 deletions
diff --git a/Tests/QtAutogen/MocOptions2/CMakeLists.txt b/Tests/QtAutogen/MocOptions2/CMakeLists.txt
new file mode 100644
index 0000000..c664f4d
--- /dev/null
+++ b/Tests/QtAutogen/MocOptions2/CMakeLists.txt
@@ -0,0 +1,10 @@
+cmake_minimum_required(VERSION 3.16)
+project(MocOptions2)
+include("../AutogenCoreTest.cmake")
+
+# Test extra options passed to moc via AUTOMOC_MOC_OPTIONS
+add_executable(mocOptions object.cpp main.cpp)
+set_property(TARGET mocOptions PROPERTY AUTOMOC ON)
+target_compile_options(mocOptions PRIVATE "-D_EXTRA_DEFINE")
+set_property(TARGET mocOptions PROPERTY AUTOMOC_MOC_OPTIONS "-D_EXTRA_DEFINE")
+target_link_libraries(mocOptions ${QT_LIBRARIES})
diff --git a/Tests/QtAutogen/MocOptions2/main.cpp b/Tests/QtAutogen/MocOptions2/main.cpp
new file mode 100644
index 0000000..98875f0
--- /dev/null
+++ b/Tests/QtAutogen/MocOptions2/main.cpp
@@ -0,0 +1,7 @@
+#include "object.hpp"
+
+int main()
+{
+ Object object;
+ return 0;
+}
diff --git a/Tests/QtAutogen/MocOptions2/object.cpp b/Tests/QtAutogen/MocOptions2/object.cpp
new file mode 100644
index 0000000..7960736
--- /dev/null
+++ b/Tests/QtAutogen/MocOptions2/object.cpp
@@ -0,0 +1,5 @@
+#include "object.hpp"
+
+Object::Object()
+{
+}
diff --git a/Tests/QtAutogen/MocOptions2/object.hpp b/Tests/QtAutogen/MocOptions2/object.hpp
new file mode 100644
index 0000000..0bb4e81
--- /dev/null
+++ b/Tests/QtAutogen/MocOptions2/object.hpp
@@ -0,0 +1,15 @@
+#ifndef Object_HPP
+#define Object_HPP
+
+#include <QObject>
+
+#ifdef _EXTRA_DEFINE
+class Object : public QObject
+{
+ Q_OBJECT
+public:
+ Object();
+};
+#endif
+
+#endif
diff --git a/Tests/QtAutogen/Tests.cmake b/Tests/QtAutogen/Tests.cmake
index 7dd9c84..d676abd 100644
--- a/Tests/QtAutogen/Tests.cmake
+++ b/Tests/QtAutogen/Tests.cmake
@@ -12,6 +12,7 @@ ADD_AUTOGEN_TEST(ManySources manySources)
ADD_AUTOGEN_TEST(MocInterfaceMacroNames)
ADD_AUTOGEN_TEST(MocOnly mocOnly)
ADD_AUTOGEN_TEST(MocOptions mocOptions)
+ADD_AUTOGEN_TEST(MocOptions2)
ADD_AUTOGEN_TEST(ObjectLibrary someProgram)
ADD_AUTOGEN_TEST(Parallel parallel)
ADD_AUTOGEN_TEST(Parallel1 parallel1)