[CMake] Source is not rebuild when header changes

Florian Lindner mailinglists at xgm.de
Tue Aug 1 06:47:26 EDT 2017


Hi,

Am 01.08.2017 um 18:32 schrieb David Cole via CMake:
> What source files include the header?

It's included by src/mapping/config/MappingConfiguration.cpp

https://github.com/precice/precice/blob/develop/src/mapping/config/MappingConfiguration.cpp

https://github.com/precice/precice/blob/develop/src/mapping/PetRadialBasisFctMapping.hpp

> Is one of them listed as a file in your project?

Yes, it's also in the CMakeFiles:

% ll build/cmake-debug/CMakeFiles/precice.dir/src/mapping/config/MappingConfiguration.cpp.o

-rw-r--r-- 1 florian florian 1517472  1. Aug 15:08
build/cmake-debug/CMakeFiles/precice.dir/src/mapping/config/MappingConfiguration.cpp.o

> Does the **including** file exist at CMake configure time, or is it
> generated later by a build step?

No, it's a standard plain file.

> What do the lines of code that include the header look like?

#include "mapping/PetRadialBasisFctMapping.hpp"

> 
> 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...)

The header file is (not the including file or the #include itself) is guarded by a define

#ifndef PRECICE_NO_PETSC

which is not set. The build also contains the functionality which is guarded thereof.

> 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.

I'm happy to provide whatever information I can.

If you want to download the entire source of the project, tell me. Right now the CMake files are not yet in the
repository, but I can create a branch and add them there.

My CMake version is 3.8.2.

Best,
Florian


> 
> 
> 
> 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