From b8ef28ae1f442144f55e23b8defffe01aa350c44 Mon Sep 17 00:00:00 2001 From: Sebastian Holtermann Date: Fri, 8 Dec 2017 20:01:48 +0100 Subject: Autogen: Tests: Separate ObjectLibrary test --- Tests/QtAutogen/CMakeLists.txt | 4 ---- Tests/QtAutogen/CommonTests.cmake | 1 + Tests/QtAutogen/ObjectLibrary/CMakeLists.txt | 18 ++++++++++++++++++ Tests/QtAutogen/ObjectLibrary/a/CMakeLists.txt | 2 ++ Tests/QtAutogen/ObjectLibrary/a/classa.cpp | 7 +++++++ Tests/QtAutogen/ObjectLibrary/a/classa.h | 23 +++++++++++++++++++++++ Tests/QtAutogen/ObjectLibrary/b/classb.cpp | 7 +++++++ Tests/QtAutogen/ObjectLibrary/b/classb.h | 23 +++++++++++++++++++++++ Tests/QtAutogen/ObjectLibrary/main.cpp | 13 +++++++++++++ Tests/QtAutogen/objectLibrary/CMakeLists.txt | 14 -------------- Tests/QtAutogen/objectLibrary/a/CMakeLists.txt | 2 -- Tests/QtAutogen/objectLibrary/a/classa.cpp | 7 ------- Tests/QtAutogen/objectLibrary/a/classa.h | 23 ----------------------- Tests/QtAutogen/objectLibrary/b/classb.cpp | 7 ------- Tests/QtAutogen/objectLibrary/b/classb.h | 23 ----------------------- Tests/QtAutogen/objectLibrary/main.cpp | 13 ------------- 16 files changed, 94 insertions(+), 93 deletions(-) create mode 100644 Tests/QtAutogen/ObjectLibrary/CMakeLists.txt create mode 100644 Tests/QtAutogen/ObjectLibrary/a/CMakeLists.txt create mode 100644 Tests/QtAutogen/ObjectLibrary/a/classa.cpp create mode 100644 Tests/QtAutogen/ObjectLibrary/a/classa.h create mode 100644 Tests/QtAutogen/ObjectLibrary/b/classb.cpp create mode 100644 Tests/QtAutogen/ObjectLibrary/b/classb.h create mode 100644 Tests/QtAutogen/ObjectLibrary/main.cpp delete mode 100644 Tests/QtAutogen/objectLibrary/CMakeLists.txt delete mode 100644 Tests/QtAutogen/objectLibrary/a/CMakeLists.txt delete mode 100644 Tests/QtAutogen/objectLibrary/a/classa.cpp delete mode 100644 Tests/QtAutogen/objectLibrary/a/classa.h delete mode 100644 Tests/QtAutogen/objectLibrary/b/classb.cpp delete mode 100644 Tests/QtAutogen/objectLibrary/b/classb.h delete mode 100644 Tests/QtAutogen/objectLibrary/main.cpp diff --git a/Tests/QtAutogen/CMakeLists.txt b/Tests/QtAutogen/CMakeLists.txt index 288ae60..8fb9ab3 100644 --- a/Tests/QtAutogen/CMakeLists.txt +++ b/Tests/QtAutogen/CMakeLists.txt @@ -60,10 +60,6 @@ if(NON_ASCII_BDIR AND WIN32) endif() # -- Test -# OBJECT libraries -add_subdirectory(objectLibrary) - -# -- Test # MacOS Framework if(APPLE AND (NOT QT_TEST_VERSION STREQUAL 4)) add_subdirectory(macosFW) diff --git a/Tests/QtAutogen/CommonTests.cmake b/Tests/QtAutogen/CommonTests.cmake index e873d06..9e49153 100644 --- a/Tests/QtAutogen/CommonTests.cmake +++ b/Tests/QtAutogen/CommonTests.cmake @@ -24,3 +24,4 @@ if(QT_TEST_ALLOW_QT_MACROS) ADD_AUTOGEN_TEST(MocCMP0071) endif() ADD_AUTOGEN_TEST(UicInclude uicInclude) +ADD_AUTOGEN_TEST(ObjectLibrary someProgram) diff --git a/Tests/QtAutogen/ObjectLibrary/CMakeLists.txt b/Tests/QtAutogen/ObjectLibrary/CMakeLists.txt new file mode 100644 index 0000000..088a24c --- /dev/null +++ b/Tests/QtAutogen/ObjectLibrary/CMakeLists.txt @@ -0,0 +1,18 @@ +cmake_minimum_required(VERSION 3.10) +project(ObjectLibrary) +include("../AutogenTest.cmake") + +set(CMAKE_INCLUDE_CURRENT_DIR ON) +set(CMAKE_AUTOMOC ON) + +# Object library a defined in a subdirectory +add_subdirectory(a) + +# Object library b defined locally +include_directories(b) +add_library(b OBJECT b/classb.cpp) +target_compile_features(b PRIVATE ${QT_COMPILE_FEATURES}) + +# Executable with OBJECT library generator expressions +add_executable(someProgram main.cpp $ $) +target_link_libraries(someProgram ${QT_LIBRARIES}) diff --git a/Tests/QtAutogen/ObjectLibrary/a/CMakeLists.txt b/Tests/QtAutogen/ObjectLibrary/a/CMakeLists.txt new file mode 100644 index 0000000..fe76ac3 --- /dev/null +++ b/Tests/QtAutogen/ObjectLibrary/a/CMakeLists.txt @@ -0,0 +1,2 @@ +add_library(a OBJECT classa.cpp) +target_compile_features(a PRIVATE ${QT_COMPILE_FEATURES}) diff --git a/Tests/QtAutogen/ObjectLibrary/a/classa.cpp b/Tests/QtAutogen/ObjectLibrary/a/classa.cpp new file mode 100644 index 0000000..4f08fda --- /dev/null +++ b/Tests/QtAutogen/ObjectLibrary/a/classa.cpp @@ -0,0 +1,7 @@ +#include "classa.h" +#include + +void ClassA::slotDoSomething() +{ + qDebug() << m_member; +} diff --git a/Tests/QtAutogen/ObjectLibrary/a/classa.h b/Tests/QtAutogen/ObjectLibrary/a/classa.h new file mode 100644 index 0000000..fa5fed9 --- /dev/null +++ b/Tests/QtAutogen/ObjectLibrary/a/classa.h @@ -0,0 +1,23 @@ +#ifndef CLASSA_H +#define CLASSA_H + +#include +#include + +class ClassA : public QObject +{ + Q_OBJECT +public: + ClassA() + : m_member("Hello A") + { + } + +public slots: + void slotDoSomething(); + +private: + QString m_member; +}; + +#endif diff --git a/Tests/QtAutogen/ObjectLibrary/b/classb.cpp b/Tests/QtAutogen/ObjectLibrary/b/classb.cpp new file mode 100644 index 0000000..26e0926 --- /dev/null +++ b/Tests/QtAutogen/ObjectLibrary/b/classb.cpp @@ -0,0 +1,7 @@ +#include "classb.h" +#include + +void ClassB::slotDoSomething() +{ + qDebug() << m_member; +} diff --git a/Tests/QtAutogen/ObjectLibrary/b/classb.h b/Tests/QtAutogen/ObjectLibrary/b/classb.h new file mode 100644 index 0000000..783bb48 --- /dev/null +++ b/Tests/QtAutogen/ObjectLibrary/b/classb.h @@ -0,0 +1,23 @@ +#ifndef CLASSB_H +#define CLASSB_H + +#include +#include + +class ClassB : public QObject +{ + Q_OBJECT +public: + ClassB() + : m_member("Hello B") + { + } + +public slots: + void slotDoSomething(); + +private: + QString m_member; +}; + +#endif diff --git a/Tests/QtAutogen/ObjectLibrary/main.cpp b/Tests/QtAutogen/ObjectLibrary/main.cpp new file mode 100644 index 0000000..cacf0fd --- /dev/null +++ b/Tests/QtAutogen/ObjectLibrary/main.cpp @@ -0,0 +1,13 @@ +#include "a/classa.h" +#include "b/classb.h" + +int main(int argc, char** argv) +{ + ClassA a; + a.slotDoSomething(); + + ClassB b; + b.slotDoSomething(); + + return 0; +} diff --git a/Tests/QtAutogen/objectLibrary/CMakeLists.txt b/Tests/QtAutogen/objectLibrary/CMakeLists.txt deleted file mode 100644 index 9b29a40..0000000 --- a/Tests/QtAutogen/objectLibrary/CMakeLists.txt +++ /dev/null @@ -1,14 +0,0 @@ -set(CMAKE_INCLUDE_CURRENT_DIR ON) -set(CMAKE_AUTOMOC ON) - -# Object library a defined in a subdirectory -add_subdirectory(a) - -# Object library b defined locally -include_directories(b) -add_library(b OBJECT b/classb.cpp) -target_compile_features(b PRIVATE ${QT_COMPILE_FEATURES}) - -# Executable with OBJECT library generator expressions -add_executable(someProgram main.cpp $ $) -target_link_libraries(someProgram ${QT_LIBRARIES}) diff --git a/Tests/QtAutogen/objectLibrary/a/CMakeLists.txt b/Tests/QtAutogen/objectLibrary/a/CMakeLists.txt deleted file mode 100644 index fe76ac3..0000000 --- a/Tests/QtAutogen/objectLibrary/a/CMakeLists.txt +++ /dev/null @@ -1,2 +0,0 @@ -add_library(a OBJECT classa.cpp) -target_compile_features(a PRIVATE ${QT_COMPILE_FEATURES}) diff --git a/Tests/QtAutogen/objectLibrary/a/classa.cpp b/Tests/QtAutogen/objectLibrary/a/classa.cpp deleted file mode 100644 index 4f08fda..0000000 --- a/Tests/QtAutogen/objectLibrary/a/classa.cpp +++ /dev/null @@ -1,7 +0,0 @@ -#include "classa.h" -#include - -void ClassA::slotDoSomething() -{ - qDebug() << m_member; -} diff --git a/Tests/QtAutogen/objectLibrary/a/classa.h b/Tests/QtAutogen/objectLibrary/a/classa.h deleted file mode 100644 index fa5fed9..0000000 --- a/Tests/QtAutogen/objectLibrary/a/classa.h +++ /dev/null @@ -1,23 +0,0 @@ -#ifndef CLASSA_H -#define CLASSA_H - -#include -#include - -class ClassA : public QObject -{ - Q_OBJECT -public: - ClassA() - : m_member("Hello A") - { - } - -public slots: - void slotDoSomething(); - -private: - QString m_member; -}; - -#endif diff --git a/Tests/QtAutogen/objectLibrary/b/classb.cpp b/Tests/QtAutogen/objectLibrary/b/classb.cpp deleted file mode 100644 index 26e0926..0000000 --- a/Tests/QtAutogen/objectLibrary/b/classb.cpp +++ /dev/null @@ -1,7 +0,0 @@ -#include "classb.h" -#include - -void ClassB::slotDoSomething() -{ - qDebug() << m_member; -} diff --git a/Tests/QtAutogen/objectLibrary/b/classb.h b/Tests/QtAutogen/objectLibrary/b/classb.h deleted file mode 100644 index 783bb48..0000000 --- a/Tests/QtAutogen/objectLibrary/b/classb.h +++ /dev/null @@ -1,23 +0,0 @@ -#ifndef CLASSB_H -#define CLASSB_H - -#include -#include - -class ClassB : public QObject -{ - Q_OBJECT -public: - ClassB() - : m_member("Hello B") - { - } - -public slots: - void slotDoSomething(); - -private: - QString m_member; -}; - -#endif diff --git a/Tests/QtAutogen/objectLibrary/main.cpp b/Tests/QtAutogen/objectLibrary/main.cpp deleted file mode 100644 index cacf0fd..0000000 --- a/Tests/QtAutogen/objectLibrary/main.cpp +++ /dev/null @@ -1,13 +0,0 @@ -#include "a/classa.h" -#include "b/classb.h" - -int main(int argc, char** argv) -{ - ClassA a; - a.slotDoSomething(); - - ClassB b; - b.slotDoSomething(); - - return 0; -} -- cgit v0.12