How to avoid unneeded dependencies on headers?

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

How to avoid unneeded dependencies on headers?

Andrew Guryanov
Hello,

I use cmake version 3.11.0.
I have the following program (in file "c.c"), where headers a.h and b.h are
empty:

#include "a.h"
#if 0
#include "b.h"
#endif
int main()
{
return 0;
}

and CMakeLists.txt:
add_executable(test c)


I run "cmake ." to configure it and then "make".
Everything builds fine.
I then "touch b.h" and again run "make" -
Make rebuilds it!

I mean, header b.h is excluded, any changes to it may be ignored.
Why there is a dependency on it?
Is this by design?
Is it possible to avoid it?

Thanks


--

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