--===============0746769225== Content-Type: multipart/alternative; boundary=001a1134f4eea30356051e37df4d --001a1134f4eea30356051e37df4d Content-Type: text/plain; charset=UTF-8 Hi, On Wed, Aug 26, 2015 at 3:10 PM, Jakob van Bethlehem < jsvanbethlehem@gmail.com> wrote: > Hej Andrew, > > CMake does never scan source files (as far as I know), as it is not a > compiler. From your question it almost seem you are making this assumption, > so I just wanted to make sure to mention at least this. > Thats wrong, CMake has to parse the source files you add to a target to be able to determine its dependencies (recursively) so it can generate makefile rules that ensure that if one of the (indirectly) included headers changes the source file is recompiled. You can see this in cmDependsC.cxx in the CMake sources for C (and possibly C++) source files. It of course does not parse the C/C++ code, it merely finds lines that start with #include or #import and figures out the absolute path of the mentioned header file based on the targets include directories. Of course you can help CMake here by specifying all headers in the add_executable/add_library call, but that easily ends up being a maintenance nightmare for files outside of your actual project (system headers, third-party libraries etc.). Andreas --001a1134f4eea30356051e37df4d Content-Type: text/html; charset=UTF-8 Content-Transfer-Encoding: quoted-printable
Hi,

On Wed, Aug 26, 2015 at 3:10 PM, Jakob van Bethlehem &= lt;jsvanbethl= ehem@gmail.com> wrote:
Hej Andrew,

CMake does n= ever scan source files (as far as I know), as it is not a compiler. From yo= ur question it almost seem you are making this assumption, so I just wanted= to make sure to mention at least this.

Thats wrong, CMake has to parse the source files you add to a targ= et to be able to determine its dependencies (recursively) so it can generat= e makefile rules that ensure that if one of the (indirectly) included heade= rs changes the source file is recompiled. You can see this in cmDependsC.cx= x in the CMake sources for C (and possibly C++) source files.
It of course does not parse the C/C++ code, it merely finds lin= es that start with #include or #import and figures out the absolute path of= the mentioned header file based on the targets include directories.
<= div>
Of course you can help CMake here by specifying all head= ers in the add_executable/add_library call, but that easily ends up being a= maintenance nightmare for files outside of your actual project (system hea= ders, third-party libraries etc.).

Andreas
--001a1134f4eea30356051e37df4d-- --===============0746769225== Content-Type: text/plain; charset="us-ascii" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit Content-Disposition: inline -- 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 --===============0746769225==--