# Incremental build not working for header files

**URL:** https://discourse.cmake.org/t/incremental-build-not-working-for-header-files/9334
**Category:** Usage
**Tags:** os:linux, gen:ninja
**Created:** [November 1, 2023, 10:05pm UTC](https://discourse.cmake.org/t/incremental-build-not-working-for-header-files/9334 "2023-11-01T22:05:45Z")
**Posts on this page:** 4
**Page:** 1

<div class="post-metadata">

### Author: ![sip2wte](https://discourse.cmake.org/letter_avatar_proxy/v4/letter/s/919ad9/32.png) [@sip2wte](https://discourse.cmake.org/u/sip2wte)
#### Post date: [November 1, 2023, 10:05pm UTC](https://discourse.cmake.org/t/incremental-build-not-working-for-header-files/9334/1 "2023-11-01T22:05:45Z")

</div>

Hi there,

I am using cmake with “Ninja Multi-Config” generator on Linux with Green hills compiler. The incremental build is not working i.e. If I make changes in the header files, it would not show me any compilation error.  
The clean build works fine after deleting the build directory. It also works fine with the clang compiler.  
The .d and .dep files are generated in the build directory and it includes the expected header files.

Thanks and regards,  
Prabhjot Singh

---

<div class="post-metadata">

### Author: ![ben.boeckel](https://discourse.cmake.org/letter_avatar_proxy/v4/letter/b/ea5d25/32.png) [@ben.boeckel](https://discourse.cmake.org/u/ben.boeckel)
#### Post date: [November 2, 2023, 9:20pm UTC](https://discourse.cmake.org/t/incremental-build-not-working-for-header-files/9334/2 "2023-11-02T21:20:15Z")

</div>

Can you share the build statements in `build.ninja` (though for NMC they might be `build-$config.ninja`) for the compilations of the objects that should be recompiling? Namely the `depfile =` and `deps =` bits. If `deps = gcc` is there, does `ninja -t deps $object` show the header?

---

<div class="post-metadata">

### Author: ![sip2wte](https://discourse.cmake.org/letter_avatar_proxy/v4/letter/s/919ad9/32.png) [@sip2wte](https://discourse.cmake.org/u/sip2wte)
#### Post date: [November 8, 2023, 5:22pm UTC](https://discourse.cmake.org/t/incremental-build-not-working-for-header-files/9334/3 "2023-11-08T17:22:09Z")

</div>

> [@ben.boeckel](#):
>
> `deps =`

Sorry for the late reply, I was on vacation.  
It shows no result for depfile and deps in build-Release.ninja.

```auto
sip3wte@sip2wte-virtual-machine:~/cycursoc/build/awr294x-r5f-ghs$ grep -inrs "depfile" build-Release.ninja 
sip3wte@sip2wte-virtual-machine:~/cycursoc/build/awr294x-r5f-ghs$ grep -inrs "deps" build-Release.ninja 
sip3wte@sip2wte-virtual-machine:~/cycursoc/build/awr294x-r5f-ghs$

```

```auto
sip3wte@sip2wte-virtual-machine:~/cycursoc/build/awr294x-r5f-ghs$ ninja -t deps CycurSoC_Sample_She_HostMcu0.elf 
CycurSoC_Sample_She_HostMcu0.elf: deps not found
sip3wte@sip2wte-virtual-machine:~/cycursoc/build/awr294x-r5f-ghs$

```

Btw, I have also tried changing the generator to “Unix MakeFiles” and it still didn’t work!

---

<div class="post-metadata">

### Author: ![jtxa](https://discourse.cmake.org/user_avatar/discourse.cmake.org/jtxa/32/1535_2.png) [@jtxa](https://discourse.cmake.org/u/jtxa)
#### Post date: [November 8, 2023, 11:11pm UTC](https://discourse.cmake.org/t/incremental-build-not-working-for-header-files/9334/4 "2023-11-08T23:11:37Z")

</div>

The GHS compiler support in CMake looks very minimalistic. It doesn’t look like the compiler flag for dependency files is configured at all.  
Can you check the content of the variable `CMAKE_DEPFILE_FLAGS_C`. If it’s empty, depfiles are currently not supported for GHS.  
I haven’t found a GHS manual in the internet, so I can’t say, if the compiler supports it all all.
