diff options
author | Orkun Tokdemir <ilhanorkuntokdemir@gmail.com> | 2023-05-31 14:48:04 (GMT) |
---|---|---|
committer | Brad King <brad.king@kitware.com> | 2023-05-31 16:59:20 (GMT) |
commit | 5380ad9d58c614aeaddb6be7a7fcc28cbf50c856 (patch) | |
tree | 9e4b24e58bc2faa584651741f8ab0f492556cecf /Tests | |
parent | 26240066084b9cbe37956cee4b3be1e75e144ce5 (diff) | |
download | CMake-5380ad9d58c614aeaddb6be7a7fcc28cbf50c856.zip CMake-5380ad9d58c614aeaddb6be7a7fcc28cbf50c856.tar.gz CMake-5380ad9d58c614aeaddb6be7a7fcc28cbf50c856.tar.bz2 |
Tests: Add test for AUTOMOC_MOC_OPTIONS
Fixes: #23894
Diffstat (limited to 'Tests')
-rw-r--r-- | Tests/QtAutogen/MocOptions2/CMakeLists.txt | 10 | ||||
-rw-r--r-- | Tests/QtAutogen/MocOptions2/main.cpp | 7 | ||||
-rw-r--r-- | Tests/QtAutogen/MocOptions2/object.cpp | 5 | ||||
-rw-r--r-- | Tests/QtAutogen/MocOptions2/object.hpp | 15 | ||||
-rw-r--r-- | Tests/QtAutogen/Tests.cmake | 1 |
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) |