Skip to content

Commit

Permalink
SuiteSparse_config: Link to OpenMP target
Browse files Browse the repository at this point in the history
  • Loading branch information
mmuetzel committed Dec 2, 2023
1 parent 47eae27 commit 944319c
Show file tree
Hide file tree
Showing 2 changed files with 25 additions and 7 deletions.
14 changes: 7 additions & 7 deletions SuiteSparse_config/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -56,11 +56,11 @@ endif ( )
# find library dependencies
#-------------------------------------------------------------------------------

option ( NOPENMP "ON: do not use OpenMP. OFF (default): use OpenMP" off )
option ( NOPENMP "ON: do not use OpenMP. OFF (default): use OpenMP" OFF )
if ( NOPENMP )
# OpenMP has been disabled
message ( STATUS "OpenMP disabled" )
set ( OPENMP_FOUND false )
set ( OPENMP_C_FOUND OFF )
else ( )
find_package ( OpenMP )
endif ( )
Expand Down Expand Up @@ -139,18 +139,18 @@ if ( NOT WIN32 )
endif ( )

# OpenMP:
if ( OPENMP_FOUND )
if ( OPENMP_C_FOUND )
message ( STATUS "OpenMP C libraries: ${OpenMP_C_LIBRARIES} ")
message ( STATUS "OpenMP C include: ${OpenMP_C_INCLUDE_DIRS} ")
message ( STATUS "OpenMP C flags: ${OpenMP_C_FLAGS} ")
if ( BUILD_SHARED_LIBS )
target_link_libraries ( SuiteSparseConfig PRIVATE ${OpenMP_C_LIBRARIES} )
target_link_libraries ( SuiteSparseConfig PRIVATE OpenMP::OpenMP_C )
target_include_directories ( SuiteSparseConfig PUBLIC
"$<TARGET_PROPERTY:OpenMP::OpenMP_C,INTERFACE_INCLUDE_DIRECTORIES>" )
endif ( )
if ( BUILD_STATIC_LIBS )
target_link_libraries ( SuiteSparseConfig_static PUBLIC ${OpenMP_C_LIBRARIES} )
target_link_libraries ( SuiteSparseConfig_static PUBLIC OpenMP::OpenMP_C )
endif ( )
set ( CMAKE_C_FLAGS "${CMAKE_C_FLAGS} ${OpenMP_C_FLAGS} " )
include_directories ( ${OpenMP_C_INCLUDE_DIRS} )
endif ( )

# BLAS:
Expand Down
18 changes: 18 additions & 0 deletions SuiteSparse_config/Config/SuiteSparse_configConfig.cmake.in
Original file line number Diff line number Diff line change
Expand Up @@ -35,6 +35,24 @@ set ( SUITESPARSE_CONFIG_VERSION_MINOR @SUITESPARSE_VERSION_MINOR@ )
set ( SUITESPARSE_CONFIG_VERSION_PATCH @SUITESPARSE_VERSION_SUB@ )
set ( SUITESPARSE_CONFIG_VERSION "@SUITESPARSE_VERSION_MAJOR@.@SUITESPARSE_VERSION_MINOR@.@SUITESPARSE_VERSION_SUB@" )

# Check for dependent targets
include ( CMakeFindDependencyMacro )
set ( _dependencies_found ON )

# Look for OpenMP
if ( NOT @NOPENMP@ AND NOT OpenMP_C_FOUND )
find_dependency ( OpenMP )
if ( NOT OpenMP_C_FOUND )
set ( _dependencies_found OFF )
endif ( )
endif ( )

if ( NOT _dependencies_found )
set ( SuiteSparse_config_FOUND OFF )
return ( )
endif ( )


include ( ${CMAKE_CURRENT_LIST_DIR}/SuiteSparse_configTargets.cmake )

# The following is only for backward compatibility with FindSuiteSparse_config.
Expand Down

0 comments on commit 944319c

Please sign in to comment.