CMake/Tests/ObjectLibrary
Brad King a833aa1167 Fix dependencies on targets linked through object libraries
When an object library is used via `target_link_libraries`, any targets
listed in the object library's `INTERFACE_LINK_LIBRARIES` closure should
become direct dependencies of the consuming target.  However, these were
accidentally left out by `cmComputeTargetDepends::CollectTargetDepends`
because object libraries are encountered through external object sources
first and then added to the `emitted` set which blocks them from being
processed as link dependencies.

This was not noticed by the test case in commit bab24e782c
(target_link_libraries: Propagate dependencies of object libraries,
2018-12-10, v3.14.0-rc1~260^2) because the relevant dependency appears
transitively through the object library target itself.

Re-order the logic to process link dependencies first, and then external
object sources.  That way object libraries used via
`target_link_libraries` will be treated as such by dependency analysis.

This also adds missing backtrace information for object libraries used
via `target_link_libraries`.  The missing information was mentioned in a
FIXME comment in the RunCMake.FileAPI test added by commit ea0a060168
(fileapi: Add test for codemodel v2, 2018-11-09, v3.14.0-rc1~257^2~7).
That comment itself was dropped by commit a0de350e2f (FileAPI test:
Break gen_check_targets() into JSON files, 2020-02-07), but we can now
update the corresponding location in the `.json` files to have the
now-expected backtrace information.

Fixes: #20421
2020-03-04 13:07:41 -05:00
..
A Revise C++ coding style using clang-format-6.0 2018-06-01 09:53:42 -04:00
B Revise C++ coding style using clang-format-6.0 2018-06-01 09:53:42 -04:00
ExportLanguages Revise C++ coding style using clang-format 2016-05-16 16:05:19 -04:00
Transitive Fix dependencies on targets linked through object libraries 2020-03-04 13:07:41 -05:00
AB.def
c.c Revise C++ coding style using clang-format-6.0 2018-06-01 09:53:42 -04:00
CMakeLists.txt Tests: Extend ObjectLibrary test with case for object lib dependencies 2020-03-04 13:04:00 -05:00
dummy.c Revise C++ coding style using clang-format 2016-05-16 16:05:19 -04:00
dummy.obj
main.c Revise C++ coding style using clang-format-6.0 2018-06-01 09:53:42 -04:00
mainAB.c Revise C++ coding style using clang-format 2016-05-16 16:05:19 -04:00