Skip to content

TARGET_OBJECTS does not work for object library created from object files

Hello. I try to create

add_library(l2 OBJECT converted.o)
file(GENERATE OUTPUT l2_dump CONTENT "$<TARGET_OBJECTS:l2>")

But looks like $<TARGET_OBJECTS:l2> does not have any items.

whole example in attachment. (after run cmake) file l2_dump is empty. If change $<TARGET_OBJECTS:l2> to $<TARGET_OBJECTS:l1> file contain object file from l1 library.

cmake --version cmake version 3.16.3

cmake_bug.zip

Edited by Brad King
To upload designs, you'll need to enable LFS and have an admin enable hashed storage. More information