Fix and simplify Fortran test compiler compatibility check
Since commit 38aab379
(Set CMAKE_<lang>_COMPILER_ID for VS generators,
2011-09-02) the VS IDE generators set the C and C++ compiler id to MSVC
and the Fortran compiler id to Intel. This caused the Fortran test to
fail compatible compiler detection because the if() test
"${CMAKE_C_COMPILER_ID}" MATCHES "MSVC"
is evaluated as the "var MATCHES regex" signature which evaluates the
compiler id "MSVC" as a variable which is defined to 1 which does not
match "MSVC".
Combine tests for non-identical but compatible compiler vendors into a
single regex match whose left hand side will not be defined as a
variable.
This commit is contained in:
parent
4ed1769186
commit
fcb2a27982
|
@ -113,16 +113,8 @@ endfunction()
|
||||||
|
|
||||||
# if the id's match or the compilers are compatible, then
|
# if the id's match or the compilers are compatible, then
|
||||||
# call the test_fortran_c_interface_module function
|
# call the test_fortran_c_interface_module function
|
||||||
if(("${CMAKE_Fortran_COMPILER_ID}" MATCHES "Intel")
|
if("${CMAKE_Fortran_COMPILER_ID}:${CMAKE_C_COMPILER_ID}" MATCHES
|
||||||
AND
|
"(Intel:MSVC|Absoft:GNU)"
|
||||||
("${CMAKE_C_COMPILER_ID}" MATCHES "MSVC")
|
|
||||||
)
|
|
||||||
set(COMPATABLE_COMPILERS TRUE)
|
|
||||||
endif()
|
|
||||||
if("${CMAKE_Fortran_COMPILER_ID}:${CMAKE_C_COMPILER_ID}" MATCHES "Absoft:GNU")
|
|
||||||
set(COMPATABLE_COMPILERS TRUE)
|
|
||||||
endif()
|
|
||||||
if(COMPATABLE_COMPILERS
|
|
||||||
OR ("${CMAKE_Fortran_COMPILER_ID}" MATCHES "${CMAKE_C_COMPILER_ID}" ))
|
OR ("${CMAKE_Fortran_COMPILER_ID}" MATCHES "${CMAKE_C_COMPILER_ID}" ))
|
||||||
test_fortran_c_interface_module()
|
test_fortran_c_interface_module()
|
||||||
else()
|
else()
|
||||||
|
|
Loading…
Reference in New Issue