Hello,
Currently using version 3.14.4, and experimenting with OBJECT libraries (https://cmake.org/cmake/help/v3.14/command/add_library.html#object-libraries)
Just ran a few tests, but it seems that targets added via add_library(foo OBJECT <sources>)
are added by default to the “all” target (at least by the make generator). Seems like a reasonable default, as it is the case for other add_library
variants.
Now: Although it is not mentioned in the docs, it seems that add_library(foo OBJECT EXCLUDE_FROM_ALL <sources>)
works as expected, i.e. that the “foo” target is not built by default, but will be built if another target “depends” on it via something like add_executable(Bar $<TARGET_OBJECTS:foo>)
The question: Can we rely on this behavior?