AUTOMOC produces same output moc file if target has two source files resides in different sub-directory
This issue was created automatically from an original Mantis Issue. Further discussion may take place here.
Consider following directory structure:
src
src/CMakeLists.txt
src/sub1
src/sub1/test.h
src/sub1/test.cpp
src/sub2
src/sub2/test.h
src/sub2/test.cpp
The src/CMakeLists.txt
:
ADD_LIBRARY( testsrc sub1/test.cpp sub2/test.cpp )
Then AUTOMOC
will produce the same moc_test.cpp
in the binary folder of src:
${BINARY_DIR}/src/moc_test.cpp
${BINARY_DIR}/src/testsrc_automoc.cpp
Which contains two lines of #include "moc_test.cpp"
.
This is not desired. CMake should keep directory structure when automocing, and produce:
${BINARY_DIR}/src/sub1/moc_test.cpp
${BINARY_DIR}/src/sub2/moc_test.cpp