diff --git a/cmake/Modules/Packages/KIM.cmake b/cmake/Modules/Packages/KIM.cmake index d9d028f6dc..31586bfbe0 100644 --- a/cmake/Modules/Packages/KIM.cmake +++ b/cmake/Modules/Packages/KIM.cmake @@ -20,9 +20,13 @@ if(PKG_KIM) message(FATAL_ERROR "Cannot build downloaded KIM-API library with Ninja build tool") endif() message(STATUS "KIM-API download requested - we will build our own") - enable_language(C) - enable_language(Fortran) + include(CheckLanguage) include(ExternalProject) + enable_language(C) + check_language(Fortran) + if(NOT CMAKE_Fortran_COMPILER) + message(FATAL_ERROR "Compiling the KIM-API library requires a Fortran compiler") + endif() ExternalProject_Add(kim_build URL https://s3.openkim.org/kim-api/kim-api-2.1.2.txz URL_MD5 6ac52e14ef52967fc7858220b208cba5