I've recently become aware of gcc's incremental linking feature, and I want to use it. The thing is, I don't write my own Makefile's - I use CMake. The inter-file dependencies and the targets are essentially the same, but I want to have CMake try to obtain them using incremental linking rather than linking from scratch?
Moreover, if it's possible to have this even for files-within libraries, i.e. when you recompile one .o
within a .a
file, instead of that whole file be reconsidered when linking the executable, only the single .o
within it is reconsidered/reapplied.
To illustrate, suppose my CMakeLists.txt
has:
add_executable(
foo
a.cpp
b.cpp
c.cpp
)
Right now, when a.cpp
changes, we get a compilation a.cpp
-> a.o
then a regular linkage a.o b.o c.o
-> foo
. I want it to be a.o foo something_else_maybe -> foo
Note: This question is not about MSVC and its own incremental linking capabilities.