Skip to content

Commit 4f00f02

Browse files
authored
Do not add -mabi flags for Loongson when the compiler is flang
1 parent f817f26 commit 4f00f02

File tree

1 file changed

+15
-11
lines changed

1 file changed

+15
-11
lines changed

cmake/fc.cmake

+15-11
Original file line numberDiff line numberDiff line change
@@ -61,21 +61,25 @@ if (${F_COMPILER} STREQUAL "GFORTRAN" OR ${F_COMPILER} STREQUAL "F95" OR CMAKE_F
6161
endif ()
6262
if (LOONGARCH64)
6363
if (BINARY64)
64-
CHECK_C_COMPILER_FLAG("-mabi=lp64d" COMPILER_SUPPORT_LP64D_ABI)
65-
if(COMPILER_SUPPORT_LP64D_ABI)
66-
set(FCOMMON_OPT "${FCOMMON_OPT} -mabi=lp64d")
67-
else()
68-
set(FCOMMON_OPT "${FCOMMON_OPT} -mabi=lp64")
69-
endif ()
64+
if (NOT CMAKE_Fortran_COMPILER_ID MATCHES "LLVMFlang.*")
65+
CHECK_C_COMPILER_FLAG("-mabi=lp64d" COMPILER_SUPPORT_LP64D_ABI)
66+
if(COMPILER_SUPPORT_LP64D_ABI)
67+
set(FCOMMON_OPT "${FCOMMON_OPT} -mabi=lp64d")
68+
else()
69+
set(FCOMMON_OPT "${FCOMMON_OPT} -mabi=lp64")
70+
endif ()
71+
endif ()
7072
if (INTERFACE64)
7173
set(FCOMMON_OPT "${FCOMMON_OPT} -fdefault-integer-8")
7274
endif ()
7375
else ()
74-
CHECK_C_COMPILER_FLAG("-mabi=ilp32d" COMPILER_SUPPORT_ILP32D_ABI)
75-
if(COMPILER_SUPPORT_ILP32D_ABI)
76-
set(FCOMMON_OPT "${FCOMMON_OPT} -mabi=ilp32d")
77-
else()
78-
set(FCOMMON_OPT "${FCOMMON_OPT} -mabi=lp32")
76+
if (NOT CMAKE_Fortran_COMPILER_ID MATCHES "LLVMFlang.*")
77+
CHECK_C_COMPILER_FLAG("-mabi=ilp32d" COMPILER_SUPPORT_ILP32D_ABI)
78+
if(COMPILER_SUPPORT_ILP32D_ABI)
79+
set(FCOMMON_OPT "${FCOMMON_OPT} -mabi=ilp32d")
80+
else()
81+
set(FCOMMON_OPT "${FCOMMON_OPT} -mabi=lp32")
82+
endif ()
7983
endif ()
8084
endif ()
8185
endif ()

0 commit comments

Comments
 (0)