From bd5096d012327d4acb44449464cb00c488450cc5 Mon Sep 17 00:00:00 2001 From: Stephen Kelly Date: Thu, 23 Feb 2012 17:05:41 +0100 Subject: Add the QtMain windows library to the CMake files. Change-Id: Iff8b9bdd4b069721103e1cd5854e56b6116d7549 Reviewed-by: Andreas Holzammer Reviewed-by: Oswald Buddenhagen Reviewed-by: Alexander Neundorf Reviewed-by: Stephen Kelly --- tests/manual/cmake/CMakeLists.txt | 1 + tests/manual/cmake/pass8/CMakeLists.txt | 20 ++++++++++++ tests/manual/cmake/pass8/myobject.cpp | 54 +++++++++++++++++++++++++++++++ tests/manual/cmake/pass8/myobject.h | 57 +++++++++++++++++++++++++++++++++ 4 files changed, 132 insertions(+) create mode 100644 tests/manual/cmake/pass8/CMakeLists.txt create mode 100644 tests/manual/cmake/pass8/myobject.cpp create mode 100644 tests/manual/cmake/pass8/myobject.h (limited to 'tests/manual') diff --git a/tests/manual/cmake/CMakeLists.txt b/tests/manual/cmake/CMakeLists.txt index 930936a7b5..2d0164a47b 100644 --- a/tests/manual/cmake/CMakeLists.txt +++ b/tests/manual/cmake/CMakeLists.txt @@ -88,3 +88,4 @@ expect_fail(fail4) expect_fail(fail5) expect_pass("pass(needsquoting)6") expect_pass(pass7) +expect_pass(pass8) diff --git a/tests/manual/cmake/pass8/CMakeLists.txt b/tests/manual/cmake/pass8/CMakeLists.txt new file mode 100644 index 0000000000..735b1bd26e --- /dev/null +++ b/tests/manual/cmake/pass8/CMakeLists.txt @@ -0,0 +1,20 @@ + +cmake_minimum_required(VERSION 2.8) + +project(pass8) + +find_package(Qt5Core REQUIRED) + +include_directories(${Qt5Core_INCLUDE_DIRS}) + +add_definitions(${Qt5Core_DEFINITIONS}) + +qt5_wrap_cpp(moc_files myobject.h) + +set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} ${Qt5Core_EXECUTABLE_COMPILE_FLAGS}") + +# On non-windows, the WIN32 is harmless, and Qt5Core_QTMAIN_LIBRARIES is empty. +# We test that it is harmless on those, and test that it builds on Windows. +# It wouldn't build if WIN32 is used and Qt5Core_QTMAIN_LIBRARIES is empty. +add_executable(myobject WIN32 myobject.cpp ${moc_files} ) +target_link_libraries(myobject ${Qt5Core_LIBRARIES} ${Qt5Core_QTMAIN_LIBRARIES}) diff --git a/tests/manual/cmake/pass8/myobject.cpp b/tests/manual/cmake/pass8/myobject.cpp new file mode 100644 index 0000000000..b6287b2540 --- /dev/null +++ b/tests/manual/cmake/pass8/myobject.cpp @@ -0,0 +1,54 @@ +/**************************************************************************** +** +** Copyright (C) 2012 Klarälvdalens Datakonsult AB, a KDAB Group company, info@kdab.com, author Stephen Kelly +** Contact: http://www.qt-project.org/ +** +** This file is part of the test suite of the Qt Toolkit. +** +** $QT_BEGIN_LICENSE:LGPL$ +** GNU Lesser General Public License Usage +** This file may be used under the terms of the GNU Lesser General Public +** License version 2.1 as published by the Free Software Foundation and +** appearing in the file LICENSE.LGPL included in the packaging of this +** file. Please review the following information to ensure the GNU Lesser +** General Public License version 2.1 requirements will be met: +** http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html. +** +** In addition, as a special exception, Nokia gives you certain additional +** rights. These rights are described in the Nokia Qt LGPL Exception +** version 1.1, included in the file LGPL_EXCEPTION.txt in this package. +** +** GNU General Public License Usage +** Alternatively, this file may be used under the terms of the GNU General +** Public License version 3.0 as published by the Free Software Foundation +** and appearing in the file LICENSE.GPL included in the packaging of this +** file. Please review the following information to ensure the GNU General +** Public License version 3.0 requirements will be met: +** http://www.gnu.org/copyleft/gpl.html. +** +** Other Usage +** Alternatively, this file may be used in accordance with the terms and +** conditions contained in a signed written agreement between you and Nokia. +** +** +** +** +** +** +** $QT_END_LICENSE$ +** +****************************************************************************/ + +#include "myobject.h" + +MyObject::MyObject(QObject *parent) + : QObject(parent) +{ + emit someSignal(); +} + +int main(int argc, char **argv) +{ + MyObject myObject; + return 0; +} diff --git a/tests/manual/cmake/pass8/myobject.h b/tests/manual/cmake/pass8/myobject.h new file mode 100644 index 0000000000..71a65ee801 --- /dev/null +++ b/tests/manual/cmake/pass8/myobject.h @@ -0,0 +1,57 @@ +/**************************************************************************** +** +** Copyright (C) 2012 Klarälvdalens Datakonsult AB, a KDAB Group company, info@kdab.com, author Stephen Kelly +** Contact: http://www.qt-project.org/ +** +** This file is part of the test suite of the Qt Toolkit. +** +** $QT_BEGIN_LICENSE:LGPL$ +** GNU Lesser General Public License Usage +** This file may be used under the terms of the GNU Lesser General Public +** License version 2.1 as published by the Free Software Foundation and +** appearing in the file LICENSE.LGPL included in the packaging of this +** file. Please review the following information to ensure the GNU Lesser +** General Public License version 2.1 requirements will be met: +** http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html. +** +** In addition, as a special exception, Nokia gives you certain additional +** rights. These rights are described in the Nokia Qt LGPL Exception +** version 1.1, included in the file LGPL_EXCEPTION.txt in this package. +** +** GNU General Public License Usage +** Alternatively, this file may be used under the terms of the GNU General +** Public License version 3.0 as published by the Free Software Foundation +** and appearing in the file LICENSE.GPL included in the packaging of this +** file. Please review the following information to ensure the GNU General +** Public License version 3.0 requirements will be met: +** http://www.gnu.org/copyleft/gpl.html. +** +** Other Usage +** Alternatively, this file may be used in accordance with the terms and +** conditions contained in a signed written agreement between you and Nokia. +** +** +** +** +** +** +** $QT_END_LICENSE$ +** +****************************************************************************/ + +#ifndef MYOBJECT_H +#define MYOBJECT_H + +#include + +class MyObject : public QObject +{ + Q_OBJECT +public: + MyObject(QObject *parent = 0); + +signals: + void someSignal(); +}; + +#endif -- cgit v1.2.3