Object library fails to propagate object files transitively
Failing build output: https://github.com/friendlyanon/object-repro/actions/runs/1190316860
/usr/bin/ld: CMakeFiles/main_lib.dir/source/lib.c.o: in function `function': lib.c:(.text+0x9): undefined reference to `function_impl' collect2: error: ld returned 1 exit status
Object Libraries may "link" to other object libraries to get usage requirements, but since they do not have a link step nothing is done with their object files. Continuing from the above example, the code:
compiles obj2.c with -DA -DOBJ, creates executable main2 with object files from main2.c and obj2.c, and links main2 to A.
In other words, when Object Libraries appear in a target's INTERFACE_LINK_LIBRARIES property they will be treated as Interface Libraries, but when they appear in a target's LINK_LIBRARIES property their object files will be included in the link too.
My use-case is to seal off platform dependent implementations in its own object library, which is a part of the library component of an executable. The library component itself is an object library, so it can be used to test the library component of the executable.