Reduce `try_compile` overhead
This is mainly an issue with third party projects, but there are many checks which are done at configure time that can instead just be deferred to compile time by the preprocessor. We should seek to reduce these as much as possible.
Techniques:
- consolidate checks for types to use the same variable name between third party packages (to use CMake's caching mechanisms)
- port to KWIML (
VTK::kwiml
) which provides most (all?) of thesizeof(basic_type)
values via the preprocessor - embed decisions that we know into the logic (e.g.,
fork()
is just not going to exist on Windows, don't check for it;memcpy
is in every platform VTK supports, etc.) - upstream what we can (probably hard; KWIML is unlikely to be accepted, but we adapt its code for inclusion upstream)
A from-scratch configure for VTK currently takes about 89s on CI. We can probably get this to be under 15s.
Cc: @brad.king (who did this for much of CMake's third party projects)
Cc: @robertmaynard @utkarsh.ayachit