Test that options to macros work.
authorStephen Kelly <stephen.kelly@kdab.com>
Mon, 5 Dec 2011 01:46:22 +0000 (02:46 +0100)
committerQt by Nokia <qt-info@nokia.com>
Tue, 6 Dec 2011 19:14:10 +0000 (20:14 +0100)
Change-Id: Id2f57cc2f64ae25f5f84d1206035b7a2c309d1c7
Reviewed-by: Clinton Stimpson <clinton@elemtech.com>
Reviewed-by: Stephen Kelly <stephen.kelly@kdab.com>
tests/manual/cmake/CMakeLists.txt
tests/manual/cmake/fail4/CMakeLists.txt [new file with mode: 0644]
tests/manual/cmake/fail4/myobject.cpp [new file with mode: 0644]
tests/manual/cmake/fail4/myobject.h [new file with mode: 0644]
tests/manual/cmake/fail4/pass4.qrc [new file with mode: 0644]
tests/manual/cmake/fail4/resource_file.txt [new file with mode: 0644]
tests/manual/cmake/fail5/CMakeLists.txt [new file with mode: 0644]
tests/manual/cmake/fail5/myobject.cpp [new file with mode: 0644]
tests/manual/cmake/fail5/myobject.h [new file with mode: 0644]

index b6d5f31..1f2bd3e 100644 (file)
@@ -29,3 +29,5 @@ endmacro()
 # expect_pass(pass1)
 expect_pass(pass2)
 expect_pass(pass3)
+expect_fail(fail4)
+expect_fail(fail5)
diff --git a/tests/manual/cmake/fail4/CMakeLists.txt b/tests/manual/cmake/fail4/CMakeLists.txt
new file mode 100644 (file)
index 0000000..dcd4b8b
--- /dev/null
@@ -0,0 +1,18 @@
+
+cmake_minimum_required(VERSION 2.8)
+
+project(pass4)
+
+find_package(Qt5Core REQUIRED)
+
+include_directories(${Qt5Core_INCLUDE_DIRS})
+
+qt5_wrap_cpp(moc_files myobject.h)
+
+# Test options. The -binary option generates a binary to dlopen instead of
+# a source file to compile. The compiler will consider it garbage when used
+# in the add_executable call.
+qt5_add_resources(rcc_files "pass4.qrc" OPTIONS -binary)
+
+add_executable(myobject myobject.cpp ${moc_files} ${rcc_files})
+target_link_libraries(myobject ${Qt5Core_LIBRARIES})
diff --git a/tests/manual/cmake/fail4/myobject.cpp b/tests/manual/cmake/fail4/myobject.cpp
new file mode 100644 (file)
index 0000000..251239c
--- /dev/null
@@ -0,0 +1,54 @@
+/****************************************************************************
+**
+** Copyright (C) 2011 Klarälvdalens Datakonsult AB, a KDAB Group company, info@kdab.com, author Stephen Kelly <stephen.kelly@kdab.com>
+** All rights reserved.
+** Contact: Nokia Corporation (qt-info@nokia.com)
+**
+** 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/fail4/myobject.h b/tests/manual/cmake/fail4/myobject.h
new file mode 100644 (file)
index 0000000..e2e908d
--- /dev/null
@@ -0,0 +1,57 @@
+/****************************************************************************
+**
+** Copyright (C) 2011 Klarälvdalens Datakonsult AB, a KDAB Group company, info@kdab.com, author Stephen Kelly <stephen.kelly@kdab.com>
+** All rights reserved.
+** Contact: Nokia Corporation (qt-info@nokia.com)
+**
+** 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 <QObject>
+
+class MyObject : public QObject
+{
+    Q_OBJECT
+public:
+    MyObject(QObject *parent = 0);
+
+signals:
+    void someSignal();
+};
+
+#endif
diff --git a/tests/manual/cmake/fail4/pass4.qrc b/tests/manual/cmake/fail4/pass4.qrc
new file mode 100644 (file)
index 0000000..00a17f5
--- /dev/null
@@ -0,0 +1,6 @@
+<!DOCTYPE RCC><RCC version="1.0">
+<qresource prefix="/">
+    <file>resource_file.txt</file>
+</qresource>
+</RCC>
+
diff --git a/tests/manual/cmake/fail4/resource_file.txt b/tests/manual/cmake/fail4/resource_file.txt
new file mode 100644 (file)
index 0000000..2c604a4
--- /dev/null
@@ -0,0 +1 @@
+Ken sent me.
diff --git a/tests/manual/cmake/fail5/CMakeLists.txt b/tests/manual/cmake/fail5/CMakeLists.txt
new file mode 100644 (file)
index 0000000..f82a62b
--- /dev/null
@@ -0,0 +1,15 @@
+
+cmake_minimum_required(VERSION 2.8)
+
+project(pass5)
+
+find_package(Qt5Core REQUIRED)
+
+include_directories(${Qt5Core_INCLUDE_DIRS})
+
+# Test options. The -i option removes the include "myobject.h" from the moc file
+# causing a compile failure. -> Options work
+qt5_wrap_cpp(moc_files myobject.h OPTIONS -i)
+
+add_executable(myobject myobject.cpp ${moc_files})
+target_link_libraries(myobject ${Qt5Core_LIBRARIES})
diff --git a/tests/manual/cmake/fail5/myobject.cpp b/tests/manual/cmake/fail5/myobject.cpp
new file mode 100644 (file)
index 0000000..251239c
--- /dev/null
@@ -0,0 +1,54 @@
+/****************************************************************************
+**
+** Copyright (C) 2011 Klarälvdalens Datakonsult AB, a KDAB Group company, info@kdab.com, author Stephen Kelly <stephen.kelly@kdab.com>
+** All rights reserved.
+** Contact: Nokia Corporation (qt-info@nokia.com)
+**
+** 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/fail5/myobject.h b/tests/manual/cmake/fail5/myobject.h
new file mode 100644 (file)
index 0000000..e2e908d
--- /dev/null
@@ -0,0 +1,57 @@
+/****************************************************************************
+**
+** Copyright (C) 2011 Klarälvdalens Datakonsult AB, a KDAB Group company, info@kdab.com, author Stephen Kelly <stephen.kelly@kdab.com>
+** All rights reserved.
+** Contact: Nokia Corporation (qt-info@nokia.com)
+**
+** 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 <QObject>
+
+class MyObject : public QObject
+{
+    Q_OBJECT
+public:
+    MyObject(QObject *parent = 0);
+
+signals:
+    void someSignal();
+};
+
+#endif