AUTOGEN: Tests: AUTOMOC SKIP_AUTOMOC and SKIP_AUTOGEN test

This commit is contained in:
Sebastian Holtermann
2016-12-31 10:25:38 +01:00
parent 0699760d5c
commit 8dbdd3e726
8 changed files with 90 additions and 0 deletions

View File

@@ -139,6 +139,28 @@ if (automoc_rerun_result)
message(SEND_ERROR "Second build of automoc_rerun failed.")
endif()
# -- Test: AUTOMOC, SKIP_AUTOMOC
# Test for SKIP_AUTOMOC and SKIP_AUTOGEN on an AUTOMOC enabled target
qtx_wrap_cpp(skipMocWrapMoc
skipSource/qItemA.hpp
skipSource/qItemB.hpp)
set(skipMocSources
skipMoc.cpp
skipSource/qItemA.cpp
skipSource/qItemB.cpp
skipSource/qItemC.cpp)
set_property(SOURCE skipSource/qItemA.cpp PROPERTY SKIP_AUTOMOC ON)
set_property(SOURCE skipSource/qItemB.cpp PROPERTY SKIP_AUTOGEN ON)
# AUTOMOC enabled only
add_executable(skipMocA ${skipMocSources} ${skipMocWrapMoc})
set_property(TARGET skipMocA PROPERTY AUTOMOC ON)
target_link_libraries(skipMocA ${QT_LIBRARIES})
# AUTOMOC and AUTOUIC enabled
add_executable(skipMocB ${skipMocSources} ${skipMocWrapMoc})
set_property(TARGET skipMocB PROPERTY AUTOMOC ON)
set_property(TARGET skipMocB PROPERTY AUTOUIC ON)
target_link_libraries(skipMocB ${QT_LIBRARIES})
# -- Test: AUTOMOC AUTORCC
# Source files with the same basename in different subdirectories
add_subdirectory(sameName)

View File

@@ -0,0 +1,14 @@
#include "skipSource/qItemA.hpp"
#include "skipSource/qItemB.hpp"
#include "skipSource/qItemC.hpp"
int main(int, char**)
{
QItemA itemA;
QItemA itemB;
QItemA itemC;
// Fails to link if the symbol is not present.
return 0;
}

View File

@@ -0,0 +1,5 @@
#include "qItemA.hpp"
void QItemA::go()
{
}

View File

@@ -0,0 +1,13 @@
#ifndef QITEMA_HPP
#define QITEMA_HPP
#include <QObject>
class QItemA : public QObject
{
Q_OBJECT
Q_SLOT
void go();
};
#endif

View File

@@ -0,0 +1,5 @@
#include "qItemB.hpp"
void QItemB::go()
{
}

View File

@@ -0,0 +1,13 @@
#ifndef QITEMB_HPP
#define QITEMB_HPP
#include <QObject>
class QItemB : public QObject
{
Q_OBJECT
Q_SLOT
void go();
};
#endif

View File

@@ -0,0 +1,5 @@
#include "qItemC.hpp"
void QItemC::go()
{
}

View File

@@ -0,0 +1,13 @@
#ifndef QITEMC_HPP
#define QITEMC_HPP
#include <QObject>
class QItemC : public QObject
{
Q_OBJECT
Q_SLOT
void go();
};
#endif