rename library check to find_link_library

This commit is contained in:
Daan 2024-05-19 15:43:15 -07:00
parent f739e4f2c3
commit 9cd7e4cc68

View File

@ -343,7 +343,7 @@ endif()
# we prefer -l<lib> test over `find_library` as sometimes core libraries
# like `libatomic` are not on the system path (see issue #898)
function(add_link_library libname outlibname)
function(find_link_library libname outlibname)
check_linker_flag(C "-l${libname}" mi_has_lib${libname})
if (mi_has_lib${libname})
message(VERBOSE "link library: -l${libname}")
@ -363,15 +363,15 @@ endfunction()
if(WIN32)
list(APPEND mi_libraries psapi shell32 user32 advapi32 bcrypt)
else()
add_link_library("pthread" MI_LIB_PTHREAD)
find_link_library("pthread" MI_LIB_PTHREAD)
if(MI_LIB_PTHREAD)
list(APPEND mi_libraries "${MI_LIB_PTHREAD}")
endif()
add_link_library("rt" MI_LIB_RT)
find_link_library("rt" MI_LIB_RT)
if(MI_LIB_RT)
list(APPEND mi_libraries "${MI_LIB_RT}")
endif()
add_link_library("atomic" MI_LIB_ATOMIC)
find_link_library("atomic" MI_LIB_ATOMIC)
if(MI_LIB_ATOMIC)
list(APPEND mi_libraries "${MI_LIB_ATOMIC}")
endif()