Skip to content

Commit 4adfe4d

Browse files
authored
Avoid linking both libgomp and libomp in mixed clang/gfortran builds
1 parent 3516fff commit 4adfe4d

File tree

1 file changed

+5
-1
lines changed

1 file changed

+5
-1
lines changed

test/CMakeLists.txt

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -21,10 +21,14 @@ endif()
2121
if (BUILD_COMPLEX16)
2222
list (APPEND OpenBLAS_Tests zblat1 zblat2 zblat3)
2323
endif()
24-
24+
message (STATUS CCOMP ${CMAKE_C_COMPILER_ID} FCOMP ${CMAKE_Fortran_COMPILER_ID})
2525
foreach(test_bin ${OpenBLAS_Tests})
2626
add_executable(${test_bin} ${test_bin}.f)
2727
target_link_libraries(${test_bin} ${OpenBLAS_LIBNAME})
28+
if (USE_OPENMP AND (${CMAKE_Fortran_COMPILER_ID} STREQUAL GNU) AND (${CMAKE_C_COMPILER_ID} STREQUAL Clang))
29+
string(REGEX REPLACE "-fopenmp" "" CMAKE_Fortran_FLAGS "${CMAKE_Fortran_FLAGS}")
30+
target_link_libraries(${test_bin} omp pthread)
31+
endif()
2832
endforeach()
2933

3034
# $1 exec, $2 input, $3 output_result

0 commit comments

Comments
 (0)