diff --git a/SuiteSparse_config/CMakeLists.txt b/SuiteSparse_config/CMakeLists.txt index bf09ff10f..84d84ad85 100644 --- a/SuiteSparse_config/CMakeLists.txt +++ b/SuiteSparse_config/CMakeLists.txt @@ -57,24 +57,32 @@ endif ( ) # find OpenMP #------------------------------------------------------------------------------- -if ( SUITESPARSE_USE_OPENMP ) +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 ( NOT SUITESPARSE_USE_OPENMP ) + set ( SUITESPARSE_CONFIG_USE_OPENMP "OFF" CACHE STRING "" FORCE ) +endif ( ) +if ( SUITESPARSE_CONFIG_USE_OPENMP OR SUITESPARSE_USE_OPENMP ) find_package ( OpenMP GLOBAL ) else ( ) # OpenMP has been disabled - message ( STATUS "OpenMP disabled" ) set ( OpenMP_C_FOUND OFF ) endif ( ) if ( OpenMP_C_FOUND ) set ( SUITESPARSE_HAS_OPENMP ON ) + set ( SUITESPARSE_CONFIG_HAS_OPENMP ON ) else ( ) set ( SUITESPARSE_HAS_OPENMP OFF ) + set ( SUITESPARSE_CONFIG_HAS_OPENMP OFF ) endif ( ) # 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 ( ) #------------------------------------------------------------------------------- # find the BLAS @@ -163,7 +171,7 @@ if ( NOT WIN32 ) endif ( ) # OpenMP: -if ( OpenMP_C_FOUND ) +if ( SUITESPARSE_CONFIG_USE_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} ")