There was a recent behavior change where the public CMake API qt_add_plugin API took into account the value of BUILD_SHARED_LIBS to decide whether the plugin should be a static or shared library. Instead, use the following new behavior - If no explicit option STATIC / SHARED option is passed, default to whatever flavor Qt was built as. Aka if Qt was configured with -shared, qt_add_plugin defaults to creating shared plugins. If it's a -static Qt, create static plugins. - If an explicit STATIC / SHARED option is set, override the default computed value with the given value. As a result BUILD_SHARED_LIBS does not affect Qt plugins anymore. This is more in line with Qt expectations. Add SHARED as a new valid option to pass to qt_add_plugin (it wasn't before). Add tests to check for the above behavior. Amends aa4a1006cbccbc180c600f9b4dc9e882bb5ed5ca Pick-to: 6.1 Fixes: QTBUG-92361 Task-number: QTBUG-88763 Change-Id: Iae806024ddd5cf10cfe58ddbcebd2818084b0bd7 Reviewed-by: Joerg Bornemann <joerg.bornemann@qt.io>
25 lines
1.1 KiB
CMake
25 lines
1.1 KiB
CMake
_qt_internal_test_expect_pass(test_plugin_shared_static_flavor
|
|
TESTNAME test_plugin_flavor_static
|
|
BUILD_OPTIONS
|
|
"-DPLUGIN_OPTIONS=STATIC"
|
|
"-DEXPECTED_PLUGIN_TARGET_TYPE=STATIC_LIBRARY")
|
|
|
|
_qt_internal_test_expect_pass(test_plugin_shared_static_flavor
|
|
TESTNAME test_plugin_flavor_shared
|
|
BUILD_OPTIONS
|
|
"-DPLUGIN_OPTIONS=SHARED"
|
|
"-DEXPECTED_PLUGIN_TARGET_TYPE=MODULE_LIBRARY")
|
|
|
|
if(QT6_IS_SHARED_LIBS_BUILD)
|
|
set(expected_plugin_target_type "MODULE_LIBRARY")
|
|
else()
|
|
set(expected_plugin_target_type "STATIC_LIBRARY")
|
|
endif()
|
|
|
|
# Check default computed value when no explicit option is set.
|
|
_qt_internal_test_expect_pass(test_plugin_shared_static_flavor
|
|
TESTNAME test_plugin_flavor_derived_from_qt_type
|
|
BUILD_OPTIONS
|
|
"-DPLUGIN_OPTIONS="
|
|
"-DEXPECTED_PLUGIN_TARGET_TYPE=${expected_plugin_target_type}")
|