dependency file(*.d) file generation in cmake

I am using cmake version 3.18.5. I have a C project for embedded system in cmake. I want the build system to generate .d files while building. my project compilation is successful but i don’t see the .d files anywhere. How to enable this?

I assume you are using Unix Makefiles generator.
In this case, CMake 3.18 manage dependencies with his own parser. Dependencies are collected in files depend.internal and depend.make in each target build directories.

If your compiler is able to generate dependencies files, you have to configure compilation step to enable this.

Nota: starting with CMake 3.20 with Makefiles generators, for some compilers, compiler itself is used to generate dependencies. In this case, .d files are now generated by default.

And just for completion’s sake, the the ninja tool (via the Ninja generator) will delete .d files that it collects into its .ninja_deps log file. You can prevent this with ninja -d keepdepfile (though it is considered a debugging facility, hence the -d flag).

I am using MinGW Makefile.
compiler : windriver diab
As you mentioned i saw depend.internal file which contains the dependency for each source file.
apart from that i passed a compiler option(-Xmake-dependency=4) which generates individual .d file for each source file.
Thank you for the support @marc.chevrier

got it… thanks for the support @ben.boeckel