Eh…I don’t think so. enable_language
should not be called from function
and there’s nothing saying find_package(VTK)
can’t be there. Users also might not be expecting C bits to be used suddenly. I feel like something like:
# Require MPI support exist.
if (TARGET VTK::mpi AND
# Require there be a reason we were looking for it.
DEFINED VTK_mpi_FOUND AND
# Require that finding it failed.
NOT VTK_mpi_FOUND)
# Detect if the C language is around.
if (NOT CMAKE_C_COMPILER_WORKS)
list(APPEND VTK_mpi_NOT_FOUND_MESSAGE
"The C language is not available; MPI needs C enabled in order to be detected")
endif ()
endif ()
(adapted for vtk-config
’s…unqiue variable naming mechanisms).