qt5base-lts/tests/auto/cmake
Alexey Edelev e80b010795 Use target_link_options to propagate object libraries
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 a1fd4f51ad
Amends 3329212815

Pick-to: 6.2
Change-Id: I14f88caeb04e357191c840abeab89b03e210b796
Reviewed-by: Qt CI Bot <qt_ci_bot@qt-project.org>
Reviewed-by: Alexandru Croitor <alexandru.croitor@qt.io>
2021-07-02 15:17:06 +02:00
..
mockplugins Remove CMake compatibility functions for old API 2021-06-04 14:27:20 +02:00
test_add_big_resource Support multiple equally named .qrc files in qt_add_big_resources 2021-05-22 22:32:27 +02:00
test_add_binary_resources_delayed_file CMake: Get tests/auto/cmake tests working 2020-07-17 09:43:04 +02:00
test_add_resource_options Another round of replacing 0 with nullptr 2020-10-07 23:02:47 +02:00
test_add_resources_binary_generated CMake: Change generated resources naming 2020-11-24 21:51:29 +01:00
test_add_resources_delayed_file CMake: Get tests/auto/cmake tests working 2020-07-17 09:43:04 +02:00
test_concurrent_module CMake: Get tests/auto/cmake tests working 2020-07-17 09:43:04 +02:00
test_dbus_module Another round of replacing 0 with nullptr 2020-10-07 23:02:47 +02:00
test_dependent_modules Another round of replacing 0 with nullptr 2020-10-07 23:02:47 +02:00
test_egl_lib CMake: Get tests/auto/cmake tests working 2020-07-17 09:43:04 +02:00
test_generating_cpp_exports Implement generating of a module cpp export header 2021-06-24 20:40:49 +02:00
test_global_promotion CMake: Allow promoting the Qt libraries to be global targets 2021-06-16 13:22:17 +02:00
test_import_plugins CMake: Revise plugin finalizer mode usage 2021-05-27 14:28:17 +02:00
test_interface CMake: Build minimal subset of tests in desktop static builds 2021-04-06 09:15:37 +01:00
test_interface_link_libraries Another round of replacing 0 with nullptr 2020-10-07 23:02:47 +02:00
test_json_plugin_includes Another round of replacing 0 with nullptr 2020-10-07 23:02:47 +02:00
test_moc_macro_target Another round of replacing 0 with nullptr 2020-10-07 23:02:47 +02:00
test_multiple_find_package CMake: Get tests/auto/cmake tests working 2020-07-17 09:43:04 +02:00
test_opengl_lib CMake: Get tests/auto/cmake tests working 2020-07-17 09:43:04 +02:00
test_platform_defs_include CMake: Get tests/auto/cmake tests working 2020-07-17 09:43:04 +02:00
test_plugin_shared_static_flavor CMake: Choose better defaults for qt_add_plugin STATIC/SHARED 2021-04-07 10:10:55 +02:00
test_plugins CMake: Get tests/auto/cmake tests working 2020-07-17 09:43:04 +02:00
test_private_includes CMake: Get tests/auto/cmake tests working 2020-07-17 09:43:04 +02:00
test_private_targets CMake: Get tests/auto/cmake tests working 2020-07-17 09:43:04 +02:00
test_QFINDTESTDATA Specify QT_TESTCASE_BUILDDIR for Qt::Test users implicitly 2021-04-08 13:16:41 +02:00
test_QT_TESTCASE_BUILDDIR Specify QT_TESTCASE_BUILDDIR for Qt::Test users implicitly 2021-04-08 13:16:41 +02:00
test_QTBUG-63422 Use target_link_options to propagate object libraries 2021-07-02 15:17:06 +02:00
test_qtmainwin_library Another round of replacing 0 with nullptr 2020-10-07 23:02:47 +02:00
test_static_resources Use target_link_options to propagate object libraries 2021-07-02 15:17:06 +02:00
test_testlib_definitions Replace QtTest headers with QTest 2020-12-22 15:20:30 +01:00
test_testlib_no_link_gui CMake: Get tests/auto/cmake tests working 2020-07-17 09:43:04 +02:00
test_testlib_no_link_widgets CMake: Get tests/auto/cmake tests working 2020-07-17 09:43:04 +02:00
test_umbrella_config CMake: Get tests/auto/cmake tests working 2020-07-17 09:43:04 +02:00
test_versionless_targets CMake: Get tests/auto/cmake tests working 2020-07-17 09:43:04 +02:00
test_wrap_cpp_and_resources Another round of replacing 0 with nullptr 2020-10-07 23:02:47 +02:00
test_wrap_cpp_options Another round of replacing 0 with nullptr 2020-10-07 23:02:47 +02:00
test(needsquoting)dirname Another round of replacing 0 with nullptr 2020-10-07 23:02:47 +02:00
tst_qaddpreroutine CMake: Fix tst_qaddpreroutine to work with static builds 2021-04-26 19:35:55 +02:00
CMakeLists.txt Implement generating of a module cpp export header 2021-06-24 20:40:49 +02:00
test_plugin_shared_static_flavor.cmake CMake: Choose better defaults for qt_add_plugin STATIC/SHARED 2021-04-07 10:10:55 +02:00