Trigger rebuild when a system header changes

classic Classic list List threaded Threaded
1 message Options
Reply | Threaded
Open this post in threaded view
|

Trigger rebuild when a system header changes

Lassi Niemistö

Hello,

 

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

 

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?

 

-Lassi


--

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:
https://cmake.org/mailman/listinfo/cmake