From 746393545f6e68292b780ea62ea2f6bef81c708c Mon Sep 17 00:00:00 2001 From: Venugopal Shivashankar Date: Tue, 9 Feb 2021 13:15:58 +0100 Subject: CMake: Port the snippet project setup to CMake Change-Id: I411e58e94752f3b2d0a3e8aac0ab7c4c2272db89 Fixes: QTBUG-89826 Reviewed-by: Qt CI Bot Reviewed-by: Paul Wicking Reviewed-by: Edward Welbourne --- src/testlib/doc/snippets/code/CMakeLists.txt | 26 ++++++++++ .../doc/snippets/code/doc_src_qtestevent.cpp | 8 +-- src/testlib/doc/snippets/code/doc_src_qtestevent.h | 58 ++++++++++++++++++++++ .../doc/snippets/code/src_qtestlib_qtestcase.cpp | 2 +- 4 files changed, 86 insertions(+), 8 deletions(-) create mode 100644 src/testlib/doc/snippets/code/CMakeLists.txt create mode 100644 src/testlib/doc/snippets/code/doc_src_qtestevent.h (limited to 'src/testlib/doc/snippets') diff --git a/src/testlib/doc/snippets/code/CMakeLists.txt b/src/testlib/doc/snippets/code/CMakeLists.txt new file mode 100644 index 0000000000..8a244e4dd6 --- /dev/null +++ b/src/testlib/doc/snippets/code/CMakeLists.txt @@ -0,0 +1,26 @@ +add_library(testlib_code_snippets OBJECT + doc_src_qtqskip.cpp + doc_src_qttest.cpp + src_corelib_kernel_qtestsupport_core.cpp +) + +target_link_libraries(testlib_code_snippets PRIVATE + Qt::Core + Qt::Test +) + +qt_internal_extend_target(testlib_code_snippets CONDITION QT_FEATURE_gui AND QT_FEATURE_sql + SOURCES + doc_src_qtestlib.cpp + PUBLIC_LIBRARIES + Qt::Gui + Qt::Sql +) + +qt_internal_extend_target(testlib_code_snippets CONDITION QT_FEATURE_widgets + SOURCES + doc_src_qtestevent.cpp + doc_src_qtestevent.h + PUBLIC_LIBRARIES + Qt::Widgets +) diff --git a/src/testlib/doc/snippets/code/doc_src_qtestevent.cpp b/src/testlib/doc/snippets/code/doc_src_qtestevent.cpp index 1d91ebd644..a987cf79fb 100644 --- a/src/testlib/doc/snippets/code/doc_src_qtestevent.cpp +++ b/src/testlib/doc/snippets/code/doc_src_qtestevent.cpp @@ -51,13 +51,7 @@ #include #include -// dummy -class TestGui: public QObject -{ - Q_OBJECT -public: - void testGui_data(); -}; +#include "doc_src_qtestevent.h" void TestGui::testGui_data() { diff --git a/src/testlib/doc/snippets/code/doc_src_qtestevent.h b/src/testlib/doc/snippets/code/doc_src_qtestevent.h new file mode 100644 index 0000000000..af2bf607f1 --- /dev/null +++ b/src/testlib/doc/snippets/code/doc_src_qtestevent.h @@ -0,0 +1,58 @@ +/**************************************************************************** +** +** Copyright (C) 2021 The Qt Company Ltd. +** Contact: https://www.qt.io/licensing/ +** +** This file is part of the documentation of the Qt Toolkit. +** +** $QT_BEGIN_LICENSE:BSD$ +** Commercial License Usage +** Licensees holding valid commercial Qt licenses may use this file in +** accordance with the commercial license agreement provided with the +** Software or, alternatively, in accordance with the terms contained in +** a written agreement between you and The Qt Company. For licensing terms +** and conditions see https://www.qt.io/terms-conditions. For further +** information use the contact form at https://www.qt.io/contact-us. +** +** BSD License Usage +** Alternatively, you may use this file under the terms of the BSD license +** as follows: +** +** "Redistribution and use in source and binary forms, with or without +** modification, are permitted provided that the following conditions are +** met: +** * Redistributions of source code must retain the above copyright +** notice, this list of conditions and the following disclaimer. +** * Redistributions in binary form must reproduce the above copyright +** notice, this list of conditions and the following disclaimer in +** the documentation and/or other materials provided with the +** distribution. +** * Neither the name of The Qt Company Ltd nor the names of its +** contributors may be used to endorse or promote products derived +** from this software without specific prior written permission. +** +** +** THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS +** "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT +** LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR +** A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT +** OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, +** SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT +** LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, +** DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY +** THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT +** (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE +** OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE." +** +** $QT_END_LICENSE$ +** +****************************************************************************/ +#include + +// dummy +class TestGui: public QObject +{ + Q_OBJECT +public: + void testGui_data(); +}; diff --git a/src/testlib/doc/snippets/code/src_qtestlib_qtestcase.cpp b/src/testlib/doc/snippets/code/src_qtestlib_qtestcase.cpp index 01f4e11eb4..ceb2743141 100644 --- a/src/testlib/doc/snippets/code/src_qtestlib_qtestcase.cpp +++ b/src/testlib/doc/snippets/code/src_qtestlib_qtestcase.cpp @@ -49,7 +49,7 @@ ****************************************************************************/ #include #include -#include +#include #include -- cgit v1.2.3