mirror of
https://github.com/Kitware/CMake.git
synced 2026-01-11 08:20:18 -06:00
Autogen: Add QtAutogen.UicNoGui test
Adds a Qt core only test that has ``AUTOUIC`` enabled targets that don't link against QtXWidgets or Qt at all.
This commit is contained in:
@@ -25,6 +25,7 @@ ADD_AUTOGEN_TEST(SameName sameName)
|
||||
ADD_AUTOGEN_TEST(StaticLibraryCycle slc)
|
||||
ADD_AUTOGEN_TEST(UicInclude uicInclude)
|
||||
ADD_AUTOGEN_TEST(UicInterface QtAutoUicInterface)
|
||||
ADD_AUTOGEN_TEST(UicNoGui uicNoGui)
|
||||
ADD_AUTOGEN_TEST(UicOnly uicOnly)
|
||||
ADD_AUTOGEN_TEST(UicSkipSource)
|
||||
|
||||
|
||||
16
Tests/QtAutogen/UicNoGui/CMakeLists.txt
Normal file
16
Tests/QtAutogen/UicNoGui/CMakeLists.txt
Normal file
@@ -0,0 +1,16 @@
|
||||
cmake_minimum_required(VERSION 3.13)
|
||||
project(UicNoGui)
|
||||
include("../AutogenCoreTest.cmake")
|
||||
|
||||
# This tests creates a target that has AUTOUIC enabled but does not
|
||||
# link against QtXWidgets.
|
||||
|
||||
set(CMAKE_AUTOMOC ON)
|
||||
set(CMAKE_AUTOUIC ON)
|
||||
set(CMAKE_AUTORCC ON)
|
||||
|
||||
add_subdirectory(MocOnly)
|
||||
add_subdirectory(NoQt)
|
||||
|
||||
add_executable(uicNoGui main.cpp)
|
||||
target_link_libraries(uicNoGui mocOnly noQt)
|
||||
3
Tests/QtAutogen/UicNoGui/MocOnly/CMakeLists.txt
Normal file
3
Tests/QtAutogen/UicNoGui/MocOnly/CMakeLists.txt
Normal file
@@ -0,0 +1,3 @@
|
||||
# Library uses QtCore only (no Widgets)
|
||||
add_library(mocOnly main.cpp)
|
||||
target_link_libraries(mocOnly ${QT_QTCORE_TARGET})
|
||||
15
Tests/QtAutogen/UicNoGui/MocOnly/main.cpp
Normal file
15
Tests/QtAutogen/UicNoGui/MocOnly/main.cpp
Normal file
@@ -0,0 +1,15 @@
|
||||
#include <QObject>
|
||||
|
||||
class LocalObject : public QObject
|
||||
{
|
||||
Q_OBJECT
|
||||
public:
|
||||
LocalObject(){};
|
||||
};
|
||||
|
||||
void mocOnly()
|
||||
{
|
||||
LocalObject obj;
|
||||
}
|
||||
|
||||
#include "main.moc"
|
||||
2
Tests/QtAutogen/UicNoGui/NoQt/CMakeLists.txt
Normal file
2
Tests/QtAutogen/UicNoGui/NoQt/CMakeLists.txt
Normal file
@@ -0,0 +1,2 @@
|
||||
# Library doesn't use or link against Qt at all
|
||||
add_library(noQt main.cpp)
|
||||
4
Tests/QtAutogen/UicNoGui/NoQt/main.cpp
Normal file
4
Tests/QtAutogen/UicNoGui/NoQt/main.cpp
Normal file
@@ -0,0 +1,4 @@
|
||||
|
||||
void noQt()
|
||||
{
|
||||
}
|
||||
9
Tests/QtAutogen/UicNoGui/main.cpp
Normal file
9
Tests/QtAutogen/UicNoGui/main.cpp
Normal file
@@ -0,0 +1,9 @@
|
||||
extern void mocOnly();
|
||||
extern void noQt();
|
||||
|
||||
int main(int argc, char* argv[])
|
||||
{
|
||||
mocOnly();
|
||||
noQt();
|
||||
return 0;
|
||||
}
|
||||
Reference in New Issue
Block a user