Skip to content

Commit

Permalink
SPQR: Add option for OpenMP again.
Browse files Browse the repository at this point in the history
SPQR might use OpenMP in the future. By default, OpenMP is disabled for
now to avoid over-linking.
  • Loading branch information
mmuetzel committed Sep 7, 2023
1 parent 4e9d1e4 commit 5ddf4e4
Showing 1 changed file with 17 additions and 0 deletions.
17 changes: 17 additions & 0 deletions SPQR/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -46,6 +46,14 @@ project ( spqr
# find library dependencies
#-------------------------------------------------------------------------------

option ( NOPENMP "ON (default): do not use OpenMP. OFF: use OpenMP" OFF )
if ( NOPENMP )
# OpenMP has been disabled
set ( OPENMP_FOUND false )
else ( )
find_package ( OpenMP )
endif ( )

find_package ( SuiteSparse_config 7.2.0
PATHS ${CMAKE_SOURCE_DIR}/../SuiteSparse_config/build NO_DEFAULT_PATH )
if ( NOT TARGET SuiteSparse::SuiteSparseConfig )
Expand Down Expand Up @@ -190,6 +198,15 @@ if ( NOT NSTATIC )
endif ( )
endif ( )

# OpenMP:
if ( OPENMP_FOUND )
target_link_libraries ( SPQR PRIVATE OpenMP::OpenMP_CXX )
if ( NOT NSTATIC )
target_link_libraries ( SPQR_static PUBLIC OpenMP::OpenMP_CXX )
list ( APPEND SPQR_STATIC_LIBS ${OpenMP_CXX_LIBRARIES} )
endif ( )
endif ( )

# libm:
if ( NOT WIN32 )
target_link_libraries ( SPQR PRIVATE m )
Expand Down

0 comments on commit 5ddf4e4

Please sign in to comment.