summaryrefslogtreecommitdiffstats
path: root/Modules
diff options
context:
space:
mode:
authorBrad King <brad.king@kitware.com>2016-04-06 13:29:58 (GMT)
committerCMake Topic Stage <kwrobot@kitware.com>2016-04-06 13:29:58 (GMT)
commitffe2dbb133851e3e8f4c9a5639d3385645253318 (patch)
tree53791ff0e17625b876a578782b922853576bac0f /Modules
parent0a628f007d0129f56696b1c4fddc206c007a2efd (diff)
parent8c4f100a56619bf115115d0bcaa322c422f0c44f (diff)
downloadCMake-ffe2dbb133851e3e8f4c9a5639d3385645253318.zip
CMake-ffe2dbb133851e3e8f4c9a5639d3385645253318.tar.gz
CMake-ffe2dbb133851e3e8f4c9a5639d3385645253318.tar.bz2
Merge topic 'mingw-w64-Fortran-platform'
8c4f100a Fortran: Fix platform id detection on mingw-w64 66fa6143 CMakeDetermineFortranCompiler: Modernize conventions
Diffstat (limited to 'Modules')
-rw-r--r--Modules/CMakeDetermineFortranCompiler.cmake26
1 files changed, 20 insertions, 6 deletions
diff --git a/Modules/CMakeDetermineFortranCompiler.cmake b/Modules/CMakeDetermineFortranCompiler.cmake
index ccafb07..4f2a70c 100644
--- a/Modules/CMakeDetermineFortranCompiler.cmake
+++ b/Modules/CMakeDetermineFortranCompiler.cmake
@@ -185,11 +185,10 @@ if(NOT CMAKE_Fortran_COMPILER_ID_RUN)
# Fall back to old is-GNU test.
if(NOT CMAKE_Fortran_COMPILER_ID)
- exec_program(${CMAKE_Fortran_COMPILER}
- ARGS ${CMAKE_Fortran_COMPILER_ID_FLAGS_LIST} -E "\"${CMAKE_ROOT}/Modules/CMakeTestGNU.c\""
- OUTPUT_VARIABLE CMAKE_COMPILER_OUTPUT RETURN_VALUE CMAKE_COMPILER_RETURN)
+ execute_process(COMMAND ${CMAKE_Fortran_COMPILER} ${CMAKE_Fortran_COMPILER_ID_FLAGS_LIST} -E "${CMAKE_ROOT}/Modules/CMakeTestGNU.c"
+ OUTPUT_VARIABLE CMAKE_COMPILER_OUTPUT RESULT_VARIABLE CMAKE_COMPILER_RETURN)
if(NOT CMAKE_COMPILER_RETURN)
- if("${CMAKE_COMPILER_OUTPUT}" MATCHES "THIS_IS_GNU")
+ if(CMAKE_COMPILER_OUTPUT MATCHES "THIS_IS_GNU")
set(CMAKE_Fortran_COMPILER_ID "GNU")
file(APPEND ${CMAKE_BINARY_DIR}${CMAKE_FILES_DIRECTORY}/CMakeOutput.log
"Determining if the Fortran compiler is GNU succeeded with "
@@ -200,16 +199,31 @@ if(NOT CMAKE_Fortran_COMPILER_ID_RUN)
"the following output:\n${CMAKE_COMPILER_OUTPUT}\n\n")
endif()
if(NOT CMAKE_Fortran_PLATFORM_ID)
- if("${CMAKE_COMPILER_OUTPUT}" MATCHES "THIS_IS_MINGW")
+ if(CMAKE_COMPILER_OUTPUT MATCHES "THIS_IS_MINGW")
set(CMAKE_Fortran_PLATFORM_ID "MinGW")
endif()
- if("${CMAKE_COMPILER_OUTPUT}" MATCHES "THIS_IS_CYGWIN")
+ if(CMAKE_COMPILER_OUTPUT MATCHES "THIS_IS_CYGWIN")
set(CMAKE_Fortran_PLATFORM_ID "Cygwin")
endif()
endif()
endif()
endif()
+ # Fall back for GNU MINGW, which is not always detected correctly
+ # (__MINGW32__ is defined for the C language, but perhaps not for Fortran!)
+ if(CMAKE_Fortran_COMPILER_ID MATCHES "GNU" AND NOT CMAKE_Fortran_PLATFORM_ID)
+ execute_process(COMMAND ${CMAKE_Fortran_COMPILER} ${CMAKE_Fortran_COMPILER_ID_FLAGS_LIST} -E "${CMAKE_ROOT}/Modules/CMakeTestGNU.c"
+ OUTPUT_VARIABLE CMAKE_COMPILER_OUTPUT RESULT_VARIABLE CMAKE_COMPILER_RETURN)
+ if(NOT CMAKE_COMPILER_RETURN)
+ if(CMAKE_COMPILER_OUTPUT MATCHES "THIS_IS_MINGW")
+ set(CMAKE_Fortran_PLATFORM_ID "MinGW")
+ endif()
+ if(CMAKE_COMPILER_OUTPUT MATCHES "THIS_IS_CYGWIN")
+ set(CMAKE_Fortran_PLATFORM_ID "Cygwin")
+ endif()
+ endif()
+ endif()
+
# Set old compiler and platform id variables.
if(CMAKE_Fortran_COMPILER_ID MATCHES "GNU")
set(CMAKE_COMPILER_IS_GNUG77 1)