浏览代码

CMakeDetermineCompilerId: Fix Intel Fortran compiler id detection

The Intel Fortran compiler needs the /fpp option to enable C
preprocessing.  Without the option the compiler may warn and ignore
preprocessor lines instead of failing with an error.  Detect the
warning and treat it as failure so that we move on to try /fpp and
detect the correct id.  Without this it works only by luck because
Intel is the first compiler id in our detection source file.
Brad King 12 年之前
父节点
当前提交
2d36c9ab60
共有 1 个文件被更改,包括 4 次插入1 次删除
  1. 4 1
      Modules/CMakeDetermineCompilerId.cmake

+ 4 - 1
Modules/CMakeDetermineCompilerId.cmake

@@ -248,7 +248,10 @@ Id flags: ${testflags}
   endif()
 
   # Check the result of compilation.
-  if(CMAKE_${lang}_COMPILER_ID_RESULT)
+  if(CMAKE_${lang}_COMPILER_ID_RESULT
+     # Intel Fortran warns and ignores preprocessor lines without /fpp
+     OR CMAKE_${lang}_COMPILER_ID_OUTPUT MATCHES "Bad # preprocessor line"
+     )
     # Compilation failed.
     set(MSG
       "Compiling the ${lang} compiler identification source file \"${src}\" failed.