diff --git a/Modules/FortranCInterface.cmake b/Modules/FortranCInterface.cmake index 580f84e17..eba97c634 100644 --- a/Modules/FortranCInterface.cmake +++ b/Modules/FortranCInterface.cmake @@ -75,6 +75,15 @@ if(FortranCInterface_SOURCE_DIR) return() endif() +#----------------------------------------------------------------------------- +# Verify that C and Fortran are available. +foreach(lang C Fortran) + if(NOT CMAKE_${lang}_COMPILER_LOADED) + message(FATAL_ERROR + "FortranCInterface requires the ${lang} language to be enabled.") + endif() +endforeach() + #----------------------------------------------------------------------------- # Set up an interface detection project. set(FortranCInterface_SOURCE_DIR ${CMAKE_ROOT}/Modules/FortranCInterface)