Skip to content

Commit

Permalink
CMake: Find only required OpenMP components.
Browse files Browse the repository at this point in the history
That speeds up configuration and avoids bogus warnings and error if,
e.g., the installed Fortran toolchain doesn't support OpenMP.
  • Loading branch information
mmuetzel committed Dec 30, 2023
1 parent ecc5398 commit 881e33f
Show file tree
Hide file tree
Showing 10 changed files with 10 additions and 10 deletions.
2 changes: 1 addition & 1 deletion CHOLMOD/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -88,7 +88,7 @@ if ( NOT SUITESPARSE_USE_OPENMP )
set ( CHOLMOD_USE_OPENMP "OFF" CACHE STRING "" FORCE )
endif ( )
if ( CHOLMOD_USE_OPENMP )
find_package ( OpenMP GLOBAL )
find_package ( OpenMP COMPONENTS C GLOBAL )
else ( )
# OpenMP has been disabled
set ( OpenMP_C_FOUND OFF )
Expand Down
2 changes: 1 addition & 1 deletion CHOLMOD/Config/CHOLMODConfig.cmake.in
Original file line number Diff line number Diff line change
Expand Up @@ -53,7 +53,7 @@ endif ( )

# Look for OpenMP
if ( @CHOLMOD_HAS_OPENMP@ AND NOT OpenMP_C_FOUND )
find_dependency ( OpenMP )
find_dependency ( OpenMP COMPONENTS C )
if ( NOT OpenMP_C_FOUND )
set ( _dependencies_found OFF )
endif ( )
Expand Down
2 changes: 1 addition & 1 deletion GraphBLAS/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -105,7 +105,7 @@ if ( NOT SUITESPARSE_USE_OPENMP )
set ( GRAPHBLAS_USE_OPENMP "OFF" CACHE STRING "" FORCE )
endif ( )
if ( GRAPHBLAS_USE_OPENMP )
find_package ( OpenMP GLOBAL )
find_package ( OpenMP COMPONENTS C GLOBAL )
else ( )
# OpenMP has been disabled.
set ( OpenMP_C_FOUND OFF )
Expand Down
2 changes: 1 addition & 1 deletion GraphBLAS/Config/GraphBLASConfig.cmake.in
Original file line number Diff line number Diff line change
Expand Up @@ -63,7 +63,7 @@ endif ( )

# Look for OpenMP
if ( @GRAPHBLAS_HAS_OPENMP@ AND NOT OpenMP_C_FOUND )
find_dependency ( OpenMP )
find_dependency ( OpenMP COMPONENTS C )
if ( NOT OpenMP_C_FOUND )
set ( _dependencies_found OFF )
endif ( )
Expand Down
2 changes: 1 addition & 1 deletion GraphBLAS/GraphBLAS/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -69,7 +69,7 @@ if ( NOT SUITESPARSE_USE_OPENMP )
set ( GRAPHBLAS_USE_OPENMP "OFF" CACHE STRING "" FORCE )
endif ( )
if ( GRAPHBLAS_USE_OPENMP )
find_package ( OpenMP )
find_package ( OpenMP COMPONENTS C )
else ( )
# OpenMP has been disabled
set ( OpenMP_C_FOUND OFF )
Expand Down
2 changes: 1 addition & 1 deletion LAGraph/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -167,7 +167,7 @@ if ( COVERAGE )
message ( STATUS "OpenMP disabled for test coverage" )
else ( )
if ( LAGRAPH_USE_OPENMP )
find_package ( OpenMP GLOBAL )
find_package ( OpenMP COMPONENTS C GLOBAL )
if ( OpenMP_C_FOUND AND BUILD_STATIC_LIBS )
list ( APPEND LAGRAPH_STATIC_LIBS ${OpenMP_C_LIBRARIES} )
endif ( )
Expand Down
2 changes: 1 addition & 1 deletion LAGraph/config/LAGraphConfig.cmake.in
Original file line number Diff line number Diff line change
Expand Up @@ -53,7 +53,7 @@ endif ( )

# Look for OpenMP
if ( @LAGRAPH_HAS_OPENMP@ AND NOT OpenMP_C_FOUND )
find_dependency ( OpenMP )
find_dependency ( OpenMP COMPONENTS C )
if ( NOT OpenMP_C_FOUND )
set ( _dependencies_found OFF )
endif ( )
Expand Down
2 changes: 1 addition & 1 deletion ParU/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -61,7 +61,7 @@ endif ( )

if ( PARU_USE_OPENMP )
# OpenMP 4.5 or later is required
find_package ( OpenMP GLOBAL )
find_package ( OpenMP COMPONENTS CXX GLOBAL )
if ( OpenMP_CXX_FOUND AND OpenMP_C_FOUND )
set ( PARU_HAS_OPENMP ON )
if (( OpenMP_CXX_VERSION VERSION_LESS 4.5 ) OR
Expand Down
2 changes: 1 addition & 1 deletion SuiteSparse_config/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -70,7 +70,7 @@ 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 )
find_package ( OpenMP COMPONENTS C GLOBAL )
else ( )
# OpenMP has been disabled
set ( OpenMP_C_FOUND OFF )
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -41,7 +41,7 @@ set ( _dependencies_found ON )

# Look for OpenMP
if ( @SUITESPARSE_HAS_OPENMP@ AND NOT OpenMP_C_FOUND )
find_dependency ( OpenMP )
find_dependency ( OpenMP COMPONENTS C )
if ( NOT OpenMP_C_FOUND )
set ( _dependencies_found OFF )
endif ( )
Expand Down

0 comments on commit 881e33f

Please sign in to comment.