Skip to content

Commit c0c6440

Browse files
authored
Merge pull request #1185 from adam-sim-dev/fix_issue_1184
For building shared libs with flang, use C linker instead of Fortran linker to avoid macOS-specific flags that CMake adds (tested CMake 4.2).
2 parents 76a3a41 + 7d21183 commit c0c6440

File tree

2 files changed

+11
-0
lines changed

2 files changed

+11
-0
lines changed

BLAS/SRC/CMakeLists.txt

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -152,6 +152,12 @@ add_library(${BLASLIB}
152152
$<TARGET_OBJECTS:${BLASLIB}_obj>
153153
$<$<BOOL:${BUILD_INDEX64_EXT_API}>: $<TARGET_OBJECTS:${BLASLIB}_64_obj>>)
154154

155+
# For flang, use C linker instead of Fortran linker to avoid macOS-specific flags
156+
# that CMake adds (tested CMake 4.2).
157+
if (CMAKE_Fortran_COMPILER_ID STREQUAL "LLVMFlang")
158+
set_target_properties (${BLASLIB} PROPERTIES LINKER_LANGUAGE C)
159+
endif()
160+
155161
set_target_properties(
156162
${BLASLIB} PROPERTIES
157163
VERSION ${LAPACK_VERSION}

SRC/CMakeLists.txt

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -578,6 +578,11 @@ add_library(${LAPACKLIB}
578578
$<TARGET_OBJECTS:mod_files>
579579
$<TARGET_OBJECTS:${LAPACKLIB}_obj>
580580
$<$<BOOL:${BUILD_INDEX64_EXT_API}>: $<TARGET_OBJECTS:${LAPACKLIB}_64_obj>>)
581+
# For flang, use C linker instead of Fortran linker to avoid macOS-specific flags
582+
# that CMake adds (tested CMake 4.2).
583+
if (CMAKE_Fortran_COMPILER_ID STREQUAL "LLVMFlang")
584+
set_target_properties (${LAPACKLIB} PROPERTIES LINKER_LANGUAGE C)
585+
endif()
581586
set_target_properties(
582587
${LAPACKLIB} PROPERTIES
583588
VERSION ${LAPACK_VERSION}

0 commit comments

Comments
 (0)