How to link executable with object created in another CMakeLists.txt in the same project?

It seems like you want an OBJECT library. With those, their objects are included in any target using them (directly) via target_link_libraries.

1 Like