Skip to content

Commit

Permalink
FindGraphBLAS: Try to make sure GRAPHBLAS_STATIC is really a static l…
Browse files Browse the repository at this point in the history
…ibrary
  • Loading branch information
mmuetzel committed Nov 30, 2023
1 parent 91a2efa commit 050d77d
Showing 1 changed file with 6 additions and 5 deletions.
11 changes: 6 additions & 5 deletions LAGraph/cmake_modules/FindGraphBLAS.cmake
Original file line number Diff line number Diff line change
Expand Up @@ -120,16 +120,14 @@ find_library ( GRAPHBLAS_LIBRARY
)

if ( MSVC )
set ( STATIC_SUFFIX .lib )
set ( STATIC_NAME graphblas_static )
else ( )
set ( STATIC_SUFFIX .a )
set ( STATIC_NAME graphblas )
endif ( )

# static SuiteSparse:GraphBLAS library
set ( save ${CMAKE_FIND_LIBRARY_SUFFIXES} )
set ( CMAKE_FIND_LIBRARY_SUFFIXES ${STATIC_SUFFIX} ${CMAKE_FIND_LIBRARY_SUFFIXES} )
set ( CMAKE_FIND_LIBRARY_SUFFIXES ${CMAKE_STATIC_LIBRARY_SUFFIX} )
find_library ( GRAPHBLAS_STATIC
NAMES ${STATIC_NAME}
HINTS ${GRAPHBLAS_ROOT}
Expand All @@ -140,6 +138,9 @@ find_library ( GRAPHBLAS_STATIC
PATH_SUFFIXES lib build alternative
)
set ( CMAKE_FIND_LIBRARY_SUFFIXES ${save} )
if ( MINGW AND GRAPHBLAS_STATIC MATCHES ".*\.dll\.a" )
set ( GRAPHBLAS_STATIC "" )
endif ( )

# get version of the library from the dynamic library name
get_filename_component ( GRAPHBLAS_LIBRARY ${GRAPHBLAS_LIBRARY} REALPATH )
Expand Down Expand Up @@ -214,13 +215,13 @@ else ( )
endif ( )

# Create target from information found
if ( NOT "${GRAPHBLAS_LIBRARY}" STREQUAL "" )
if ( GRAPHBLAS_LIBRARY )
add_library ( GraphBLAS::GraphBLAS UNKNOWN IMPORTED )
set_target_properties ( GraphBLAS::GraphBLAS PROPERTIES
IMPORTED_LOCATION "${GRAPHBLAS_LIBRARY}"
IMPORTED_INCLUDE_DIRECTORIES "${GRAPHBLAS_INCLUDE_DIR}" )
endif ( )
if ( NOT "${GRAPHBLAS_STATIC}" STREQUAL "" )
if ( GRAPHBLAS_STATIC )
add_library ( GraphBLAS::GraphBLAS_static UNKNOWN IMPORTED )
set_target_properties ( GraphBLAS::GraphBLAS_static PROPERTIES
IMPORTED_LOCATION "${GRAPHBLAS_STATIC}"
Expand Down

0 comments on commit 050d77d

Please sign in to comment.