QT5: moc_compilation.cpp.o for an OBJECT target never built if AUTOMOC == ON and AUTORCC == ON
OS: Gentoo linux
Cmake: 3.8.3
Qt: 5.7.1
Recently I've upgraded CMake to 3.7 to 3.8 and started getting this error. I've attached a reproducer project. If I set AUTORCC OFF or move the OBJECT target one level up so that it resides next to main.cpp everything seems fine. But otherwise I get:
messer:1117:0:/home/vkirsano/sandbit/reproducer/build> cmake ..
-- The C compiler identification is GNU 5.4.0
-- The CXX compiler identification is GNU 5.4.0
-- Check for working C compiler: /usr/bin/cc
-- Check for working C compiler: /usr/bin/cc -- works
-- Detecting C compiler ABI info
-- Detecting C compiler ABI info - done
-- Detecting C compile features
-- Detecting C compile features - done
-- Check for working CXX compiler: /usr/bin/c++
-- Check for working CXX compiler: /usr/bin/c++ -- works
-- Detecting CXX compiler ABI info
-- Detecting CXX compiler ABI info - done
-- Detecting CXX compile features
-- Detecting CXX compile features - done
-- Configuring done
-- Generating done
-- Build files have been written to: /home/vkirsano/sandbit/reproducer/build
messer:1118:0:/home/vkirsano/sandbit/reproducer/build> make
Scanning dependencies of target foo_autogen
[ 12%] Automatic MOC and RCC for target foo
Generating MOC compilation foo_autogen/moc_compilation.cpp
Generating RCC source foo_autogen/EWIEGA46WW/qrc_main.cpp
RCC: Warning: No resources in '/home/vkirsano/sandbit/reproducer/main.qrc'.
[ 12%] Built target foo_autogen
Scanning dependencies of target object_autogen
[ 25%] Automatic MOC for target object
Generating MOC source object_autogen/EWIEGA46WW/moc_object.cpp
Generating MOC compilation object_autogen/moc_compilation.cpp
[ 25%] Built target object_autogen
Scanning dependencies of target object
[ 37%] Building CXX object object/CMakeFiles/object.dir/object.cpp.o
[ 50%] Built target object
Scanning dependencies of target foo
[ 62%] Building CXX object CMakeFiles/foo.dir/main.cpp.o
[ 75%] Building CXX object CMakeFiles/foo.dir/foo_autogen/moc_compilation.cpp.o
[ 87%] Building CXX object CMakeFiles/foo.dir/foo_autogen/EWIEGA46WW/qrc_main.cpp.o
make[2]: *** No rule to make target 'object/CMakeFiles/object.dir/object_autogen/moc_compilation.cpp.o', needed by 'foo'.
Stop.
make[1]: *** [CMakeFiles/Makefile2:69: CMakeFiles/foo.dir/all] Error 2
make: *** [Makefile:84: all] Error 2