Automoc generated sources don't always work with objects libraries
With CMake 3.9.0 and the makefile generator, Automoc generated sources for object libraries are ignored when the object library is not used in the same CMakeLists file where it was defined. The same worked without problems in earlier CMake versions. A complete example is attached (cmake-automoc-bug.tar.gz), but the relevant part is the following:
# a_autogen/mocs_compilation.cpp is generated, but never compiled
add_subdirectory(a) # contains "add_library(a OBJECT classa.cpp)"
# b_autogen/mocs_compilation.cpp is compiled as intended
include_directories(b)
add_library(b OBJECT
b/classb.cpp
)
add_executable(someProgram
main.cpp
$<TARGET_OBJECTS:a>
$<TARGET_OBJECTS:b>
)