mirror of
https://github.com/Kitware/CMake.git
synced 2026-03-01 12:18:36 -06:00
AUTOGEN: Tests: AUTOMOC SKIP_AUTOMOC and SKIP_AUTOGEN test
This commit is contained in:
@@ -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)
|
||||
|
||||
14
Tests/QtAutogen/skipMoc.cpp
Normal file
14
Tests/QtAutogen/skipMoc.cpp
Normal 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;
|
||||
}
|
||||
5
Tests/QtAutogen/skipSource/qItemA.cpp
Normal file
5
Tests/QtAutogen/skipSource/qItemA.cpp
Normal file
@@ -0,0 +1,5 @@
|
||||
#include "qItemA.hpp"
|
||||
|
||||
void QItemA::go()
|
||||
{
|
||||
}
|
||||
13
Tests/QtAutogen/skipSource/qItemA.hpp
Normal file
13
Tests/QtAutogen/skipSource/qItemA.hpp
Normal file
@@ -0,0 +1,13 @@
|
||||
#ifndef QITEMA_HPP
|
||||
#define QITEMA_HPP
|
||||
|
||||
#include <QObject>
|
||||
|
||||
class QItemA : public QObject
|
||||
{
|
||||
Q_OBJECT
|
||||
Q_SLOT
|
||||
void go();
|
||||
};
|
||||
|
||||
#endif
|
||||
5
Tests/QtAutogen/skipSource/qItemB.cpp
Normal file
5
Tests/QtAutogen/skipSource/qItemB.cpp
Normal file
@@ -0,0 +1,5 @@
|
||||
#include "qItemB.hpp"
|
||||
|
||||
void QItemB::go()
|
||||
{
|
||||
}
|
||||
13
Tests/QtAutogen/skipSource/qItemB.hpp
Normal file
13
Tests/QtAutogen/skipSource/qItemB.hpp
Normal file
@@ -0,0 +1,13 @@
|
||||
#ifndef QITEMB_HPP
|
||||
#define QITEMB_HPP
|
||||
|
||||
#include <QObject>
|
||||
|
||||
class QItemB : public QObject
|
||||
{
|
||||
Q_OBJECT
|
||||
Q_SLOT
|
||||
void go();
|
||||
};
|
||||
|
||||
#endif
|
||||
5
Tests/QtAutogen/skipSource/qItemC.cpp
Normal file
5
Tests/QtAutogen/skipSource/qItemC.cpp
Normal file
@@ -0,0 +1,5 @@
|
||||
#include "qItemC.hpp"
|
||||
|
||||
void QItemC::go()
|
||||
{
|
||||
}
|
||||
13
Tests/QtAutogen/skipSource/qItemC.hpp
Normal file
13
Tests/QtAutogen/skipSource/qItemC.hpp
Normal file
@@ -0,0 +1,13 @@
|
||||
#ifndef QITEMC_HPP
|
||||
#define QITEMC_HPP
|
||||
|
||||
#include <QObject>
|
||||
|
||||
class QItemC : public QObject
|
||||
{
|
||||
Q_OBJECT
|
||||
Q_SLOT
|
||||
void go();
|
||||
};
|
||||
|
||||
#endif
|
||||
Reference in New Issue
Block a user