Support marking source files as "independent"
This would allow CMake to optimize dependencies to indicate that the compilation of other sources in the same target do not need to depend on the independent source itself. As an example, if we generate gen.cxx
and it is in the same target as not_gen.cxx
, non_gen.cxx.o
will wait for gen.cxx
to exist before compiling non_gen.cxx
. If there were a way to mark generated sources as "independent", CMake could break this
Initial implementation was performed in !8904 (closed). It was observed that in a VTK build of the CMakeFiles/vtkCommonCorePython.dir/CMakeFiles/vtkCommonCorePython/vtkABIPython.cxx.o
object that:
- without any file sets, 869 tasks needed to be performed from a clean build
- utilizing CMP0154 and header filesets reduced this to 541 tasks
- using
SOURCES
file sets from !8904 (closed) reduced it further to 343 tasks
By pruning these unnecessary dependencies, builds will be able to have more work available to utilize available parallelism and complete builds sooner.
The SOURCES
name of the file set is not accurate for this behavior; or at least the behavior that is intended. Instead, it is probably beneficial to have SOURCES
file sets and utilize a way to set properties on the file sets (rather than the sources because the sources can be shared between targets) to indicate that this is the state of the build.