Skip to content

Commit

Permalink
GraphBLAS: Check for ability to link with libdl.
Browse files Browse the repository at this point in the history
On some platforms (like NetBSD), `dlopen` and similar functions are not
in a library. They can be used in any dynamically linked program instead:
https://man.netbsd.org/dlopen.3

Use a feature test during configuration to check whether linking to libdl
is necessary (or possible).
  • Loading branch information
mmuetzel committed Jun 12, 2024
1 parent 360713d commit 9320995
Showing 1 changed file with 3 additions and 1 deletion.
4 changes: 3 additions & 1 deletion GraphBLAS/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -409,7 +409,9 @@ if ( NOT NO_LIBM )
endif ( )

# libdl
if ( NOT WIN32 )
include ( CheckLibraryExists )
check_library_exists ( "dl" "dlopen" "${CMAKE_LIBRARY_PATH}" HAVE_DL )
if ( HAVE_DL AND NOT WIN32 )
if ( BUILD_SHARED_LIBS )
target_link_libraries ( GraphBLAS PRIVATE dl )
endif ( )
Expand Down

0 comments on commit 9320995

Please sign in to comment.