Thanks Attila, really appreciate your help. On Wed, May 11, 2016 at 11:23 PM, Attila Krasznahorkay < attila.krasznahor...@gmail.com> wrote:
> Hi Tiago, > > Indeed, that page is quite a bit misleading. And it seems to be "liked" by > Google a lot, as most people come across it. (I also found it myself when > looking for CMake documentation early on.) > > In general, listing all source files belonging to a library/executable, > even the ones that are not compiled, is a good habit. As it makes the > generated VS and Xcode projects much nicer to use. > > I didn't look at the internals of the Qt CMake code. I just realised this > behaviour while trying to make our own code work. (It's an intuitive > behaviour, so it wasn't too hard to figure out.) I guess the code has some > fallback to search for headers in the same place as their corresponding > source file. Which can make the project still work without declaring the > header files, as long as they are in the same directory with the source > files. I imagine that doing something more complicated to look for the > headers would not be so easy. (I can't even think of a reliable way of > doing it myself. You can't just rely on the include paths of your > component, as that would introduce a lot of possible problems.) > > All in all, I just accepted this behaviour as-is. > > Cheers, > Attila > > > On 12 May 2016, at 05:20, Hendrik Sattler <p...@hendrik-sattler.de> > wrote: > > > > > > > > Am 12. Mai 2016 00:00:12 MESZ, schrieb Tiago Macarios < > tiagomacar...@gmail.com>: > >> Hi Attila, > >> > >> Thank you for your help. You are right, if I apply the following > >> modifications it works indeed: > >> > >> set( proj_HEADER > >> include/a.h > >> ) > >> > >> add_library(proj SHARED ${proj_SOURCE} ${proj_HEADER}) > >> > >> But now I got a second question. Why is adding the header files > >> necessary? > >> (Sorry the possibly naive question) > >> > >> I thought that adding the header files to the target was an > >> anti-pattern ( > >> > http://voices.canonical.com/jussi.pakkanen/2013/03/26/a-list-of-common-cmake-antipatterns/ > >> ). 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? > > > > That same page has a Errata section at the end. > > > > -- > > Diese Nachricht wurde von meinem Android-Mobiltelefon mit K-9 Mail > gesendet. > > -- > > > > Powered by www.kitware.com > > > > Please keep messages on-topic and check the CMake FAQ at: > http://www.cmake.org/Wiki/CMake_FAQ > > > > Kitware offers various services to support the CMake community. For more > information on each offering, please visit: > > > > CMake Support: http://cmake.org/cmake/help/support.html > > CMake Consulting: http://cmake.org/cmake/help/consulting.html > > CMake Training Courses: http://cmake.org/cmake/help/training.html > > > > Visit other Kitware open-source projects at > http://www.kitware.com/opensource/opensource.html > > > > Follow this link to subscribe/unsubscribe: > > http://public.kitware.com/mailman/listinfo/cmake > >
-- Powered by www.kitware.com Please keep messages on-topic and check the CMake FAQ at: http://www.cmake.org/Wiki/CMake_FAQ Kitware offers various services to support the CMake community. For more information on each offering, please visit: CMake Support: http://cmake.org/cmake/help/support.html CMake Consulting: http://cmake.org/cmake/help/consulting.html CMake Training Courses: http://cmake.org/cmake/help/training.html Visit other Kitware open-source projects at http://www.kitware.com/opensource/opensource.html Follow this link to subscribe/unsubscribe: http://public.kitware.com/mailman/listinfo/cmake