<div dir="ltr">Hi Attila,<div><br></div><div>Thank you for your help. You are right, if I apply the following modifications it works indeed:</div><div><br></div><div><div>set( proj_HEADER</div><div>    include/a.h</div><div>)</div><div><br></div><div>add_library(proj SHARED ${proj_SOURCE} ${proj_HEADER})</div></div><div><br></div><div>But now I got a second question. Why is adding the header files necessary? (Sorry the possibly naive question)</div><div><br></div><div>I thought that adding the header files to the target was an anti-pattern ( <a href="http://voices.canonical.com/jussi.pakkanen/2013/03/26/a-list-of-common-cmake-antipatterns/">http://voices.canonical.com/jussi.pakkanen/2013/03/26/a-list-of-common-cmake-antipatterns/</a> ). Is it related to moc generating header files during the build? If so why is it not a problem when everything is on the same folder?</div><div><br></div><div>Tiago</div><div><br></div></div><div class="gmail_extra"><br><div class="gmail_quote">On Wed, May 11, 2016 at 12:48 AM, Attila Krasznahorkay <span dir="ltr"><<a href="mailto:attila.krasznahorkay@gmail.com" target="_blank">attila.krasznahorkay@gmail.com</a>></span> wrote:<br><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">Hi Tiago,<br>
<br>
This is one of those cases when you have to declare the header files to add_library(...) as well. In that case AUTOMOC should work fine. At least it does for us, in a very similar setup.<br>
<br>
<a href="http://acode-browser.usatlas.bnl.gov/lxr/source/atlas/graphics/VP1/VP1Gui/CMakeLists.txt" rel="noreferrer" target="_blank">http://acode-browser.usatlas.bnl.gov/lxr/source/atlas/graphics/VP1/VP1Gui/CMakeLists.txt</a><br>
<br>
Cheers,<br>
            Attila<br>
<div><div class="h5"><br>
> On 11 May 2016, at 07:14, Tiago Macarios <<a href="mailto:tiagomacarios@gmail.com">tiagomacarios@gmail.com</a>> wrote:<br>
><br>
> Hi,<br>
><br>
> I am having trouble using AUTOMOC with a project where header files and source files are in different sub-directories. I wrote a detailed stack overflow question here:<br>
> <a href="http://stackoverflow.com/questions/37151163/cmake-automoc-with-files-on-different-folders" rel="noreferrer" target="_blank">http://stackoverflow.com/questions/37151163/cmake-automoc-with-files-on-different-folders</a><br>
> and would really appreciate if someone could give me a couple of ideas to try out.<br>
><br>
> Thanks,<br>
> Tiago<br>
</div></div>> --<br>
><br>
> Powered by <a href="http://www.kitware.com" rel="noreferrer" target="_blank">www.kitware.com</a><br>
><br>
> Please keep messages on-topic and check the CMake FAQ at: <a href="http://www.cmake.org/Wiki/CMake_FAQ" rel="noreferrer" target="_blank">http://www.cmake.org/Wiki/CMake_FAQ</a><br>
><br>
> Kitware offers various services to support the CMake community. For more information on each offering, please visit:<br>
><br>
> CMake Support: <a href="http://cmake.org/cmake/help/support.html" rel="noreferrer" target="_blank">http://cmake.org/cmake/help/support.html</a><br>
> CMake Consulting: <a href="http://cmake.org/cmake/help/consulting.html" rel="noreferrer" target="_blank">http://cmake.org/cmake/help/consulting.html</a><br>
> CMake Training Courses: <a href="http://cmake.org/cmake/help/training.html" rel="noreferrer" target="_blank">http://cmake.org/cmake/help/training.html</a><br>
><br>
> Visit other Kitware open-source projects at <a href="http://www.kitware.com/opensource/opensource.html" rel="noreferrer" target="_blank">http://www.kitware.com/opensource/opensource.html</a><br>
><br>
> Follow this link to subscribe/unsubscribe:<br>
> <a href="http://public.kitware.com/mailman/listinfo/cmake" rel="noreferrer" target="_blank">http://public.kitware.com/mailman/listinfo/cmake</a><br>
<br>
</blockquote></div><br></div>