forked from qt-creator/qt-creator
Plugin wizard: Fix missing include, add some test infrastructure
Just basic CMake setup that is needed for actually adding tests. Change-Id: Ief778c28f27ff122c82a190a334b7a932bead658 Reviewed-by: Cristian Adam <cristian.adam@qt.io>
This commit is contained in:
@@ -22,6 +22,23 @@ find_package(QtCreator REQUIRED COMPONENTS Core)
|
|||||||
find_package(QT NAMES Qt6 Qt5 REQUIRED COMPONENTS Widgets)
|
find_package(QT NAMES Qt6 Qt5 REQUIRED COMPONENTS Widgets)
|
||||||
set(QtX Qt${QT_VERSION_MAJOR})
|
set(QtX Qt${QT_VERSION_MAJOR})
|
||||||
|
|
||||||
|
# Add a CMake option that enables building your plugin with tests.
|
||||||
|
# You don't want your released plugin binaries to contain tests,
|
||||||
|
# so make that default to 'NO'.
|
||||||
|
# Enable tests by passing -DWITH_TESTS=ON to CMake.
|
||||||
|
option(WITH_TESTS "Builds with tests" NO)
|
||||||
|
|
||||||
|
if(WITH_TESTS)
|
||||||
|
# Look for QtTest
|
||||||
|
find_package(${QtX} REQUIRED COMPONENTS Test)
|
||||||
|
|
||||||
|
# Tell CMake functions like add_qtc_plugin about the QtTest component.
|
||||||
|
set(IMPLICIT_DEPENDS Qt::Test)
|
||||||
|
|
||||||
|
# Enable ctest for auto tests.
|
||||||
|
enable_testing()
|
||||||
|
endif()
|
||||||
|
|
||||||
add_qtc_plugin(%{PluginName}
|
add_qtc_plugin(%{PluginName}
|
||||||
PLUGIN_DEPENDS
|
PLUGIN_DEPENDS
|
||||||
QtCreator::Core
|
QtCreator::Core
|
||||||
|
@@ -6,6 +6,8 @@
|
|||||||
#define %{GLOBAL_GUARD}
|
#define %{GLOBAL_GUARD}
|
||||||
@endif
|
@endif
|
||||||
|
|
||||||
|
#include <qglobal.h>
|
||||||
|
|
||||||
#if defined(%{LibraryDefine})
|
#if defined(%{LibraryDefine})
|
||||||
# define %{LibraryExport} Q_DECL_EXPORT
|
# define %{LibraryExport} Q_DECL_EXPORT
|
||||||
#else
|
#else
|
||||||
|
Reference in New Issue
Block a user