e80b010795
target_link_options are placed by CMake at the beginning of a linker line. This gives us an opportunity to use the function to propagate object libraries. This change adds one more check in the root Config.cmake file. If CMP0099 policy is enabled, CMake enables propagating of the linking options when linking two static libraries using the PRIVATE linking visibility, so we can rely on the correct linking order and expect object libraries to be propagated. Note that on the platforms where cmake version is higher than 3.16 Qt uses CMP0099 NEW in functions like qt_add_executable. This means that at the moment of creating an executable target the TARGET_POLICY genex will also be NEW, so we do not take into the account the user defined CMP0099. If the CMP0099 policy is not available for a certain CMake version we skip the TARGET_POLICY check and simply disable propagation of the object libraries using target_link_options for both user and Qt libraries. This is applicable for the CMake versions 3.16 and less. Linking approaches have the following priorities(from higher to lower) after this change: - target_link_libraries - works if link order matters not or CMake version greater equal 3.21. - target_link_options - works if CMP0099 is set to NEW by user or if the CMake version is greater than or equal to 3.17 and an executable is created using Qt functions. - object library finalizer - works if CMake version is greater equal 3.19 or qt6_finalize_target is called explicitly. - target_sources - is used when all the other approaches could not be used. Amends |
||
---|---|---|
.. | ||
mockplugins | ||
test_add_big_resource | ||
test_add_binary_resources_delayed_file | ||
test_add_resource_options | ||
test_add_resources_binary_generated | ||
test_add_resources_delayed_file | ||
test_concurrent_module | ||
test_dbus_module | ||
test_dependent_modules | ||
test_egl_lib | ||
test_generating_cpp_exports | ||
test_global_promotion | ||
test_import_plugins | ||
test_interface | ||
test_interface_link_libraries | ||
test_json_plugin_includes | ||
test_moc_macro_target | ||
test_multiple_find_package | ||
test_opengl_lib | ||
test_platform_defs_include | ||
test_plugin_shared_static_flavor | ||
test_plugins | ||
test_private_includes | ||
test_private_targets | ||
test_QFINDTESTDATA | ||
test_QT_TESTCASE_BUILDDIR | ||
test_QTBUG-63422 | ||
test_qtmainwin_library | ||
test_static_resources | ||
test_testlib_definitions | ||
test_testlib_no_link_gui | ||
test_testlib_no_link_widgets | ||
test_umbrella_config | ||
test_versionless_targets | ||
test_wrap_cpp_and_resources | ||
test_wrap_cpp_options | ||
test(needsquoting)dirname | ||
tst_qaddpreroutine | ||
CMakeLists.txt | ||
test_plugin_shared_static_flavor.cmake |