(0037827)
|
Kelly Thompson
|
2015-01-26 20:40
|
|
It looks like CMakeFortranCompilerID.F.in is setup to 'print *' these 'INFO:' strings. While it probably wouldn't work in all cases (e.g. cross compiling), why not attempt to run the binary created from CMakeFortranCompilerID.F.in? For example, in CMakeDetermineCompilerId.cmake:
diff --git a/Modules/CMakeDetermineCompilerId.cmake b/Modules/CMakeDetermineCompilerId.cmake
index dfed00e..3aa64fb 100644
--- a/Modules/CMakeDetermineCompilerId.cmake
+++ b/Modules/CMakeDetermineCompilerId.cmake
@@ -413,8 +413,17 @@ function(CMAKE_DETERMINE_COMPILER_ID_CHECK lang file)
set(ARCHITECTURE_ID)
set(SIMULATE_ID)
set(SIMULATE_VERSION)
- file(STRINGS ${file}
- CMAKE_${lang}_COMPILER_ID_STRINGS LIMIT_COUNT 6 REGEX "INFO:[A-Za-z0-9_]+\\[[^]]*\\]")
+ if( lang MATCHES Fortran )
+ execute_process(
+ COMMAND ${file}
+ OUTPUT_VARIABLE CMAKE_${lang}_COMPILER_ID_STRINGS
+ OUTPUT_STRIP_TRAILING_WHITESPACE
+ )
+ endif()
+ if( NOT CMAKE_${lang}_COMPILER_ID_STRINGS MATCHES "INFO:compiler" )
+ file(STRINGS ${file}
+ CMAKE_${lang}_COMPILER_ID_STRINGS LIMIT_COUNT 6 REGEX "INFO:[A-Za-z0-9_]+\\[[^]]*\\]")
+ endif()
set(COMPILER_ID_TWICE)
Along with these changes in CMakeFortranCompilerId.F.in
--- a/Modules/CMakeFortranCompilerId.F.in
+++ b/Modules/CMakeFortranCompilerId.F.in
@@ -3,7 +3,55 @@
! Identify the compiler
#endif
#if defined(__INTEL_COMPILER) || defined(__ICC)
- PRINT *, 'INFO:compiler[Intel]'
+
+ character(len=10) :: str_compiler_major
+ character(len=10) :: str_compiler_minor
+ character(len=10) :: str_compiler_patch
+ character(len=10) :: str_compiler_tweak
+ character(len=40) :: str_compiler_version
+ integer :: compiler_major
+ integer :: compiler_minor
+ integer :: compiler_patch
+ integer :: compiler_tweak
+
+ compiler_major = __INTEL_COMPILER/100
+ compiler_minor = mod(__INTEL_COMPILER/10,10)
+# if defined(__INTEL_COMPILER_UPDATE)
+ compiler_patch = __INTEL_COMPILER_UPDATE
+#else
+ compiler_patch = mod(__INTEL_COMPILER,10)
+#endif
+# if defined(__INTEL_COMPILER_BUILD_DATE)
+ compiler_tweak = __INTEL_COMPILER_BUILD_DATE
+# endif
+
+ write( str_compiler_major, "(I10)") compiler_major
+ write( str_compiler_minor, "(I10)") compiler_minor
+ write( str_compiler_patch, "(I10)") compiler_patch
+ write( str_compiler_tweak, "(I10)") compiler_tweak
+ str_compiler_major = adjustl(str_compiler_major)
+ str_compiler_minor = adjustl(str_compiler_minor)
+ str_compiler_patch = adjustl(str_compiler_patch)
+ str_compiler_tweak = adjustl(str_compiler_tweak)
+ str_compiler_version = trim(str_compiler_major) // '.'
+ & // trim(str_compiler_minor) // '.'
+ & // trim(str_compiler_patch) // '.'
+ & // trim(str_compiler_tweak)
+
+ print *, 'INFO:compiler[Intel]'
+ print *, 'INFO:compiler_version[' ,
+ & trim( adjustl(str_compiler_version)) , ']'
+
# if defined(_MSC_VER)
PRINT *, 'INFO:simulate[MSVC]'
# if _MSC_VER >= 1800 |
|