瀏覽代碼

Teach FortranCInterface to verify languages

This module requires both C and Fortran to be enabled, so error-out if
they are not.
Brad King 16 年之前
父節點
當前提交
f64f9940af
共有 1 個文件被更改,包括 9 次插入0 次删除
  1. 9 0
      Modules/FortranCInterface.cmake

+ 9 - 0
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)