diff options
Diffstat (limited to 'tests/auto/cmake/test_wrap_cpp_moc')
-rw-r--r-- | tests/auto/cmake/test_wrap_cpp_moc/CMakeLists.txt | 19 | ||||
-rw-r--r-- | tests/auto/cmake/test_wrap_cpp_moc/main.cpp | 17 |
2 files changed, 36 insertions, 0 deletions
diff --git a/tests/auto/cmake/test_wrap_cpp_moc/CMakeLists.txt b/tests/auto/cmake/test_wrap_cpp_moc/CMakeLists.txt new file mode 100644 index 0000000000..c00a9d83c5 --- /dev/null +++ b/tests/auto/cmake/test_wrap_cpp_moc/CMakeLists.txt @@ -0,0 +1,19 @@ +# Copyright (C) 2024 The Qt Company Ltd. +# SPDX-License-Identifier: BSD-3-Clause + +cmake_minimum_required(VERSION 3.16) + +project(test_wrap_cpp_and_resources) + +find_package(Qt6Core REQUIRED) + +add_executable(example main.cpp) + +qt_wrap_cpp(moc_files main.cpp TARGET example) + +# expect the generated moc files to be empty when a source file is passed +if (NOT moc_files STREQUAL "") + message(FATAL_ERROR "test_qt_wrap_cpp_moc: moc_files should be empty") +endif() + +target_link_libraries(example PRIVATE Qt::Core) diff --git a/tests/auto/cmake/test_wrap_cpp_moc/main.cpp b/tests/auto/cmake/test_wrap_cpp_moc/main.cpp new file mode 100644 index 0000000000..28ebfe0536 --- /dev/null +++ b/tests/auto/cmake/test_wrap_cpp_moc/main.cpp @@ -0,0 +1,17 @@ +// Copyright (C) 2024 The Qt Company Ltd. +// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR GPL-3.0-only + +#include <QObject> + +class MyObject2 : public QObject { + Q_OBJECT +public: + MyObject2() = default; +}; + +#include "main.moc" + +int main() +{ + return 0; +} |