Autogen: Tests: Separate MocMacroName test

This commit is contained in:
Sebastian Holtermann 2017-12-08 19:15:26 +01:00
parent 5cab8c307c
commit fb7e52ca3d
14 changed files with 33 additions and 19 deletions

View File

@ -59,12 +59,6 @@ if(NON_ASCII_BDIR AND WIN32)
set(ALLOW_WRAP_CPP FALSE)
endif()
# -- Test
# MOC AUTOMOC_MACRO_NAMES
if (NOT QT_TEST_VERSION STREQUAL 4)
add_subdirectory(mocMacroName)
endif()
# -- Test
# Tests AUTOMOC with generated sources
add_subdirectory(mocDepends)

View File

@ -12,3 +12,6 @@ if(QT_TEST_ALLOW_QT_MACROS)
endif()
ADD_AUTOGEN_TEST(UicSkipSource)
ADD_AUTOGEN_TEST(RccSkipSource)
if(NOT QT_TEST_VERSION STREQUAL 4)
ADD_AUTOGEN_TEST(MocMacroName mocMacroName)
endif()

View File

@ -0,0 +1,17 @@
cmake_minimum_required(VERSION 3.10)
project(MocMacroName)
include("../AutogenTest.cmake")
# Test CMAKE_AUTOMOC_MACRO_NAMES and AUTOMOC_MACRO_NAMES
list(APPEND CMAKE_AUTOMOC_MACRO_NAMES "QO1_ALIAS")
add_executable(mocMacroName
main.cpp
Gadget.cpp
Object.cpp
Object1Aliased.cpp
Object2Aliased.cpp
)
set_property(TARGET mocMacroName PROPERTY AUTOMOC ON)
set_property(TARGET mocMacroName APPEND PROPERTY AUTOMOC_MACRO_NAMES "QO2_ALIAS")
target_link_libraries(mocMacroName ${QT_LIBRARIES})

View File

@ -1,6 +1,6 @@
#include "Gadget.hpp"
Gadget::Gadget()
: test(0)
: _test(0)
{
}

View File

@ -6,10 +6,14 @@
class Gadget
{
Q_GADGET
Q_PROPERTY(int test MEMBER test)
Q_PROPERTY(int test READ getTest)
public:
Gadget();
int test;
int getTest() { return _test; }
private:
int _test;
};
#endif

View File

@ -1,6 +1,7 @@
#include "Object.hpp"
Object::Object()
: _test(0)
{
}

View File

@ -6,14 +6,17 @@
class Object : public QObject
{
Q_OBJECT
Q_PROPERTY(int test MEMBER test)
Q_PROPERTY(int test READ getTest)
public:
Object();
int getTest() { return _test; }
Q_SLOT
void aSlot();
int test;
private:
int _test;
};
#endif

View File

@ -1,8 +0,0 @@
cmake_minimum_required(VERSION 3.9)
list(APPEND CMAKE_AUTOMOC_MACRO_NAMES "QO1_ALIAS")
add_executable(mmn main.cpp Gadget.cpp Object.cpp Object1Aliased.cpp Object2Aliased.cpp)
set_property(TARGET mmn PROPERTY AUTOMOC ON)
set_property(TARGET mmn APPEND PROPERTY AUTOMOC_MACRO_NAMES "QO2_ALIAS")
target_link_libraries(mmn ${QT_LIBRARIES})