[CMake] Source is not rebuild when header changes

David Cole DLRdave at aol.com
Tue Aug 1 06:32:39 EDT 2017


What source files include the header?
Is one of them listed as a file in your project?
Does the **including** file exist at CMake configure time, or is it
generated later by a build step?
What do the lines of code that include the header look like?

CMake uses its own analysis of the source files to determine the
depends information, since it needs to generate it without invoking
the compiler. This leads to a less-than-100% rate of correctness in
the depends information, although usually, it is misses "in the other
direction" due to depending on a header file which is included in some
conditionally compiled block. (So the typical problem is an extra
dependency, not a missing one...)

Perhaps passing along the includers and the exact lines and context of
being included will give us a hint about why the dependency is not
generated properly in your case.


HTH,
David C.




On Tue, Aug 1, 2017 at 5:18 AM, Florian Lindner <mailinglists at xgm.de> wrote:
> Hello,
>
> on my project, which I'm currently testing with cmake, I just noticed, that when I modify a header, the project is not
> rebuilt.
>
> The CMakeLists.txt in the root dir is here: https://pastebin.com/vfReTM1N
>
> The other CMakeLists.txt resides in root/src and lists all the source (*.cpp) files using GLOBS and adds them to the
> parent scope:
>
> set (sourcesAllNoMain ${sourcesAllNoMain} PARENT_SCOPE)
> set (sourcesTests ${sourcesTests} PARENT_SCOPE)
> set (sourcesTarchTests ${sourcesTarchTests} PARENT_SCOPE)
>
>
> the questionable header file was not added recently, so I don't think its related to the GLOBs.
>
> The header file is also not listed in depends.make file.
>
> What other information can I give?
>
> Thanks,
> Florian
> --
>
> 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


More information about the CMake mailing list