VTK handles it this way:
- Create an option which makes just the tools used on the host during a build (https://gitlab.kitware.com/vtk/vtk/blob/a5f938b2fdfefa522439065e040cb42f65d88444/CMakeLists.txt#L231) and install a package with a different namespace than normal builds
- If cross compiling without an emulator, require that host tools package (https://gitlab.kitware.com/vtk/vtk/blob/master/CMake/vtkCrossCompiling.cmake)
- If the host tools are found, use them in the
add_custom_command
call (https://gitlab.kitware.com/vtk/vtk/blob/a5f938b2fdfefa522439065e040cb42f65d88444/CMake/vtkModule.cmake#L3047), usingCMAKE_CROSSCOMPILING_EMULATOR
if available