Skip to content

FindOpenMP: Use NO_DEFAULT_PATH where appropriate

Christian Pfeiffer requested to merge ChrisTX/cmake:fomp-no-def-path into master

OpenMP libraries must always be found in the implicit linking directories of a compiler when using the OpenMP compile flag. If a suitable OpenMP library is also found in for example some CMAKE_PREFIX_PATH, this can lead to the module finding the incorrect library. On the other hand, CMAKE_PREFIX_PATH can't ever be a location that we need to consider since the OpenMP compile flag would not work if we needed to.

I realized this mistake today when trying to use the system compiler while I had my spack environment loaded.

Merge request reports