mirror of
https://github.com/crystalidea/qt6windows7.git
synced 2025-07-03 07:45:30 +08:00
qt 6.5.1 original
This commit is contained in:
34
tests/auto/cmake/test_interface/CMakeLists.txt
Normal file
34
tests/auto/cmake/test_interface/CMakeLists.txt
Normal file
@ -0,0 +1,34 @@
|
||||
# Copyright (C) 2022 The Qt Company Ltd.
|
||||
# SPDX-License-Identifier: BSD-3-Clause
|
||||
|
||||
|
||||
cmake_minimum_required(VERSION 3.16)
|
||||
|
||||
project(test_interface)
|
||||
|
||||
find_package(Qt6Widgets)
|
||||
|
||||
set(CMAKE_AUTOMOC ON)
|
||||
set(CMAKE_INCLUDE_CURRENT_DIR ON)
|
||||
|
||||
add_executable(test_interface_exe WIN32 main.cpp mainwindow.cpp)
|
||||
|
||||
# No need to specify include directories, compile definitions, the PIC flag, or to
|
||||
# link explicitly to Qt::WinMain.
|
||||
target_link_libraries(test_interface_exe Qt::Widgets)
|
||||
|
||||
# Fix try_compile to inherit the parent configuration.
|
||||
set(CMAKE_TRY_COMPILE_CONFIGURATION "${CMAKE_BUILD_TYPE}")
|
||||
|
||||
# Can't use source file based try_compile, because it doesn't handle object libraries
|
||||
# referenced in generator expressions properly.
|
||||
try_compile(_TRY_COMPILE_RES
|
||||
"${CMAKE_CURRENT_BINARY_DIR}/widget_test"
|
||||
"${CMAKE_CURRENT_SOURCE_DIR}/widget_test"
|
||||
widget_test
|
||||
OUTPUT_VARIABLE TC_OV
|
||||
)
|
||||
|
||||
if (NOT _TRY_COMPILE_RES)
|
||||
message(SEND_ERROR "The use of try_compile with Qt::Widgets failed. The output was :\n${TC_OV}")
|
||||
endif()
|
20
tests/auto/cmake/test_interface/main.cpp
Normal file
20
tests/auto/cmake/test_interface/main.cpp
Normal file
@ -0,0 +1,20 @@
|
||||
// Copyright (C) 2012 Klarälvdalens Datakonsult AB, a KDAB Group company, info@kdab.com, author Stephen Kelly <stephen.kelly@kdab.com>
|
||||
// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR GPL-3.0-only WITH Qt-GPL-exception-1.0
|
||||
|
||||
#include <QApplication>
|
||||
|
||||
#include "mainwindow.h"
|
||||
|
||||
#if !defined(QT_CORE_LIB) || !defined(QT_GUI_LIB) || !defined(QT_WIDGETS_LIB)
|
||||
#error Missing module definitions
|
||||
#endif
|
||||
|
||||
int main(int argc, char **argv)
|
||||
{
|
||||
QApplication app(argc, argv);
|
||||
|
||||
MainWindow mw;
|
||||
mw.show();
|
||||
|
||||
return app.exec();
|
||||
}
|
10
tests/auto/cmake/test_interface/mainwindow.cpp
Normal file
10
tests/auto/cmake/test_interface/mainwindow.cpp
Normal file
@ -0,0 +1,10 @@
|
||||
// Copyright (C) 2012 Klarälvdalens Datakonsult AB, a KDAB Group company, info@kdab.com, author Stephen Kelly <stephen.kelly@kdab.com>
|
||||
// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR GPL-3.0-only WITH Qt-GPL-exception-1.0
|
||||
|
||||
#include "mainwindow.h"
|
||||
|
||||
MainWindow::MainWindow(QWidget *parent)
|
||||
: QWidget(parent)
|
||||
{
|
||||
|
||||
}
|
19
tests/auto/cmake/test_interface/mainwindow.h
Normal file
19
tests/auto/cmake/test_interface/mainwindow.h
Normal file
@ -0,0 +1,19 @@
|
||||
// Copyright (C) 2012 Klarälvdalens Datakonsult AB, a KDAB Group company, info@kdab.com, author Stephen Kelly <stephen.kelly@kdab.com>
|
||||
// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR GPL-3.0-only WITH Qt-GPL-exception-1.0
|
||||
|
||||
#ifndef MAINWINDOW_H
|
||||
#define MAINWINDOW_H
|
||||
|
||||
#include <QWidget>
|
||||
|
||||
class MainWindow : public QWidget
|
||||
{
|
||||
Q_OBJECT
|
||||
public:
|
||||
MainWindow(QWidget *parent = nullptr);
|
||||
|
||||
signals:
|
||||
void somethingHappened();
|
||||
};
|
||||
|
||||
#endif
|
15
tests/auto/cmake/test_interface/widget_test/CMakeLists.txt
Normal file
15
tests/auto/cmake/test_interface/widget_test/CMakeLists.txt
Normal file
@ -0,0 +1,15 @@
|
||||
# Copyright (C) 2022 The Qt Company Ltd.
|
||||
# SPDX-License-Identifier: BSD-3-Clause
|
||||
|
||||
cmake_minimum_required(VERSION 3.16)
|
||||
|
||||
project(test_interface_try_compile)
|
||||
|
||||
find_package(Qt6Widgets)
|
||||
|
||||
set(CMAKE_AUTOMOC ON)
|
||||
set(CMAKE_INCLUDE_CURRENT_DIR ON)
|
||||
|
||||
add_executable(test_interface_try_compile_exe main.cpp)
|
||||
target_link_libraries(test_interface_try_compile_exe Qt::Widgets)
|
||||
|
4
tests/auto/cmake/test_interface/widget_test/main.cpp
Normal file
4
tests/auto/cmake/test_interface/widget_test/main.cpp
Normal file
@ -0,0 +1,4 @@
|
||||
#include <QString>
|
||||
#include <QWidget>
|
||||
|
||||
int main(int, char**) { QWidget w; w.show(); return 0; }
|
Reference in New Issue
Block a user