It seems CMake has a special handling for system header dependencies. I.e. if my .c file includes /usr/include/someheader.h, modifying the someheader.h does not cause the .c file to be rebuilt.
How to work around this issue? We have some custom libraries that get installed to system paths and they change relatively often. It is error-prone for the developers to accidentally keep using the library with old header
Things I have tried this far:
* add_dependencies(target /path/to/header.h) à no luck
* add_library(include_deplib /path/to/header.h) + target_link_libraries(target include_deplib)
à needs additional tweaking to be legal, still does not work
* OBJECT_DEPENDS property pointing to the .h fileà This works but I need to do this for each c. file separately
I wonder if this should be this difficult, I am probably missing something? Can I just somehow enable tracking system headers also as expected-to-change dependencies?