DrTimothyAldenDavis / SuiteSparse

The official SuiteSparse library: a suite of sparse matrix algorithms authored or co-authored by Tim Davis, Texas A&M University.
https://people.engr.tamu.edu/davis/suitesparse.html
Other
1.11k stars 256 forks source link

Example: Don't include OpenMP header if building without it. #809

Closed mmuetzel closed 1 month ago

mmuetzel commented 1 month ago

Include omp.h only if _OPENMP is defined.

This fixes an issue when trying to build the example on a system on which no OpenMP implementation can be detected by CMake.

Afaict, the example doesn't use any OpenMP features directly. So, it shouldn't be necessary at all to include the OpenMP header. If a library requires that the OpenMP header is included, that library should include it in its own header.

Should including omp.h in the header of the example be removed entirely?

DrTimothyAldenDavis commented 1 month ago

Let's go with this change.

Should including omp.h in the header of the example be removed entirely?

Perhaps, but for now, let's keep this as modified with the ifdef. That way there's a little less churn in the repo. I'd rather not break something else just now, since there are a lot of other PRs that are breaking things at the moment (on the mac), or changes in the github runners (alpine for instance).