NVHPC compiler + Ninja misses header dependencies
With CMake 3.20.1 and nvc++ 21.2 (NVHPC 21.2) then include dependencies are silently not added with the Ninja generator.
A quick and dirty test adding
seems to improve the situation in a small test project.
-MT <DEP TARGET>, which is documented in
nvc++ -help, seems to modify the name of the target printed to the dependency file (as expected), but causes errors because it apparently stops the compiled object file being written. I am not sure what the downside, if any, of omitting the
-MT option is.
If the Makefile generator is used then dependencies seem to be handled correctly.
I pushed a small demonstrator to https://gitlab.kitware.com/olupton/nvhpc-build-dependencies