summaryrefslogtreecommitdiffstats
path: root/Modules/CMakeDetermineCompilerId.cmake
diff options
context:
space:
mode:
authorBrad King <brad.king@kitware.com>2013-10-11 14:40:18 (GMT)
committerBrad King <brad.king@kitware.com>2013-10-16 14:37:48 (GMT)
commit2d36c9ab60f9d1fa5304ebf23b09fa79ff8b667e (patch)
treef61fb7220b8023d02bbd950fc758d92fb17e0fc5 /Modules/CMakeDetermineCompilerId.cmake
parenta6fd17ce50b18dd9d06cdd7fdb34bf68e987f7fc (diff)
downloadCMake-2d36c9ab60f9d1fa5304ebf23b09fa79ff8b667e.zip
CMake-2d36c9ab60f9d1fa5304ebf23b09fa79ff8b667e.tar.gz
CMake-2d36c9ab60f9d1fa5304ebf23b09fa79ff8b667e.tar.bz2
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.
Diffstat (limited to 'Modules/CMakeDetermineCompilerId.cmake')
-rw-r--r--Modules/CMakeDetermineCompilerId.cmake5
1 files changed, 4 insertions, 1 deletions
diff --git a/Modules/CMakeDetermineCompilerId.cmake b/Modules/CMakeDetermineCompilerId.cmake
index 71f15df..4c2b506 100644
--- a/Modules/CMakeDetermineCompilerId.cmake
+++ b/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.