According the doc
add_library(<name> OBJECT [<source>...])
<source>... is optional
However I got error without a source:
No SOURCES given to target: TARGET
The issue is reproducible with cmake 3.20