Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

CMake: Try to handle *_USE_OPENMP more consistently. #744

Closed
wants to merge 1 commit into from
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion CHOLMOD/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -95,7 +95,7 @@ else ( )
set ( OpenMP_C_FOUND OFF )
endif ( )

if ( OpenMP_C_FOUND )
if ( CHOLMOD_USE_OPENMP AND OpenMP_C_FOUND )
set ( CHOLMOD_HAS_OPENMP ON )
else ( )
set ( CHOLMOD_HAS_OPENMP OFF )
Expand Down
2 changes: 1 addition & 1 deletion GraphBLAS/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -109,7 +109,7 @@ else ( )
set ( OpenMP_C_FOUND OFF )
endif ( )

if ( OpenMP_C_FOUND )
if ( GRAPHBLAS_USE_OPENMP AND OpenMP_C_FOUND )
set ( GRAPHBLAS_HAS_OPENMP ON )
else ( )
set ( GRAPHBLAS_HAS_OPENMP OFF )
Expand Down
2 changes: 1 addition & 1 deletion LAGraph/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -181,7 +181,7 @@ else ( )
endif ( )
endif ( )

if ( OpenMP_C_FOUND )
if ( LAGRAPH_USE_OPENMP AND OpenMP_C_FOUND )
set ( LAGRAPH_HAS_OPENMP ON )
else ( )
set ( LAGRAPH_HAS_OPENMP OFF )
Expand Down
2 changes: 1 addition & 1 deletion LAGraph/experimental/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -85,7 +85,7 @@ endif ( )
# add OpenMP
#-------------------------------------------------------------------------------

if ( OpenMP_C_FOUND )
if ( LAGRAPH_HAS_OPENMP )
if ( BUILD_SHARED_LIBS )
target_link_libraries ( LAGraphX PRIVATE OpenMP::OpenMP_C )
endif ( )
Expand Down
2 changes: 1 addition & 1 deletion LAGraph/experimental/test/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -74,7 +74,7 @@ endif ( )
# add OpenMP
#-------------------------------------------------------------------------------

if ( OpenMP_C_FOUND )
if ( LAGRAPH_HAS_OPENMP )
if ( BUILD_SHARED_LIBS )
target_link_libraries ( lagraphxtest PRIVATE OpenMP::OpenMP_C )
endif ( )
Expand Down
2 changes: 1 addition & 1 deletion LAGraph/src/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -90,7 +90,7 @@ endif ( )
# add OpenMP
#-------------------------------------------------------------------------------

if ( OpenMP_C_FOUND )
if ( LAGRAPH_HAS_OPENMP )
if ( BUILD_SHARED_LIBS )
target_link_libraries ( LAGraph PRIVATE OpenMP::OpenMP_C )
endif ( )
Expand Down
2 changes: 1 addition & 1 deletion LAGraph/src/test/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -76,7 +76,7 @@ endif ( )
# add OpenMP
#-------------------------------------------------------------------------------

if ( OpenMP_C_FOUND )
if ( LAGRAPH_HAS_OPENMP )
if ( BUILD_SHARED_LIBS )
target_link_libraries ( lagraphtest PRIVATE OpenMP::OpenMP_C )
endif ( )
Expand Down
12 changes: 3 additions & 9 deletions SuiteSparse_config/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -71,7 +71,7 @@ endif ( )
#-------------------------------------------------------------------------------

option ( SUITESPARSE_CONFIG_USE_OPENMP "ON: Use OpenMP in SuiteSparse_config if available. OFF: Do not use OpenMP. (Default: SUITESPARSE_USE_OPENMP)" ${SUITESPARSE_USE_OPENMP} )
if ( SUITESPARSE_CONFIG_USE_OPENMP OR SUITESPARSE_USE_OPENMP )
if ( SUITESPARSE_CONFIG_USE_OPENMP )
if ( CMAKE_VERSION VERSION_LESS 3.24 )
find_package ( OpenMP COMPONENTS C )
else ( )
Expand All @@ -82,20 +82,14 @@ else ( )
set ( OpenMP_C_FOUND OFF )
endif ( )

if ( OpenMP_C_FOUND )
set ( SUITESPARSE_HAS_OPENMP ON )
if ( SUITESPARSE_CONFIG_USE_OPENMP AND OpenMP_C_FOUND )
set ( SUITESPARSE_CONFIG_HAS_OPENMP ON )
else ( )
set ( SUITESPARSE_HAS_OPENMP OFF )
set ( SUITESPARSE_CONFIG_HAS_OPENMP OFF )
endif ( )
message ( STATUS "SuiteSparse has OpenMP: ${SUITESPARSE_HAS_OPENMP}" )
message ( STATUS "SuiteSparse_config has OpenMP: ${SUITESPARSE_CONFIG_HAS_OPENMP}" )

# check for strict usage
if ( SUITESPARSE_USE_STRICT AND SUITESPARSE_USE_OPENMP AND NOT SUITESPARSE_HAS_OPENMP )
message ( FATAL_ERROR "OpenMP required for SuiteSparse but not found" )
endif ( )
if ( SUITESPARSE_USE_STRICT AND SUITESPARSE_CONFIG_USE_OPENMP AND NOT SUITESPARSE_CONFIG_HAS_OPENMP )
message ( FATAL_ERROR "OpenMP required for SuiteSparse_config but not found" )
endif ( )
Expand Down Expand Up @@ -212,7 +206,7 @@ if ( NOT NO_LIBM )
endif ( )

# OpenMP:
if ( SUITESPARSE_CONFIG_USE_OPENMP )
if ( SUITESPARSE_CONFIG_HAS_OPENMP )
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} ")
Expand Down
Loading