CMake: Fix tst_plugin
It is not possible to exclude targets based on the build configuration in CMake. loadDebugPlugin() and loadReleasePlugin() will always fail as both debug and release plugins are built regardless of the build configuration. This patch adds the CMAKE_BUILD define and skips the opposite test on Windows. E.g.: With config = Debug, the loadReleasePlugin() test is skipped and viceversa. Change-Id: I2659882604bb39eb11d3e9e2b2b37a2972475285 Reviewed-by: Alexandru Croitor <alexandru.croitor@qt.io>
This commit is contained in:
parent
0959c75d16
commit
a2376f4ded
@ -21,5 +21,7 @@ add_qt_test(tst_qplugin
|
|||||||
TESTDATA ${test_data}
|
TESTDATA ${test_data}
|
||||||
)
|
)
|
||||||
|
|
||||||
|
target_compile_definitions(tst_qplugin PRIVATE CMAKE_BUILD=1)
|
||||||
|
|
||||||
add_dependencies(tst_qplugin invalidplugin debugplugin releaseplugin)
|
add_dependencies(tst_qplugin invalidplugin debugplugin releaseplugin)
|
||||||
# special case end
|
# special case end
|
||||||
|
@ -81,6 +81,9 @@ void tst_QPlugin::loadDebugPlugin()
|
|||||||
QObject *object = loader.instance();
|
QObject *object = loader.instance();
|
||||||
QVERIFY(object != 0);
|
QVERIFY(object != 0);
|
||||||
#else
|
#else
|
||||||
|
# if defined(CMAKE_BUILD) && defined(QT_NO_DEBUG)
|
||||||
|
QSKIP("Skipping test as it is not possible to disable build targets based on configuration with CMake");
|
||||||
|
# endif
|
||||||
// loading a plugin is dependent on which lib we are running against
|
// loading a plugin is dependent on which lib we are running against
|
||||||
# if defined(QT_NO_DEBUG)
|
# if defined(QT_NO_DEBUG)
|
||||||
// release build, we cannot load debug plugins
|
// release build, we cannot load debug plugins
|
||||||
@ -111,6 +114,9 @@ void tst_QPlugin::loadReleasePlugin()
|
|||||||
QObject *object = loader.instance();
|
QObject *object = loader.instance();
|
||||||
QVERIFY(object != 0);
|
QVERIFY(object != 0);
|
||||||
#else
|
#else
|
||||||
|
# if defined(CMAKE_BUILD) && !defined(QT_NO_DEBUG)
|
||||||
|
QSKIP("Skipping test as it is not possible to disable build targets based on configuration with CMake");
|
||||||
|
# endif
|
||||||
// loading a plugin is dependent on which lib we are running against
|
// loading a plugin is dependent on which lib we are running against
|
||||||
# if defined(QT_NO_DEBUG)
|
# if defined(QT_NO_DEBUG)
|
||||||
// release build, we can load debug plugins
|
// release build, we can load debug plugins
|
||||||
|
Loading…
x
Reference in New Issue
Block a user