summaryrefslogtreecommitdiff
path: root/Modules/FindOpenMP.cmake
diff options
context:
space:
mode:
authorChristian Pfeiffer <cpfeiffer@live.de>2017-11-15 15:05:41 +0100
committerChristian Pfeiffer <cpfeiffer@live.de>2017-11-15 15:05:41 +0100
commit98314d536e23168333bce28703668683192d7bd2 (patch)
tree18dd9225e33f42569dd3e2ff897d0d01a28dfddc /Modules/FindOpenMP.cmake
parente31288582977c10972af9baa3b0e41d758094d21 (diff)
downloadcmake-98314d536e23168333bce28703668683192d7bd2.tar.gz
FindOpenMP: Use NO_DEFAULT_PATH where appropriate
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.
Diffstat (limited to 'Modules/FindOpenMP.cmake')
-rw-r--r--Modules/FindOpenMP.cmake3
1 files changed, 3 insertions, 0 deletions
diff --git a/Modules/FindOpenMP.cmake b/Modules/FindOpenMP.cmake
index 489476b195..a6eba6e919 100644
--- a/Modules/FindOpenMP.cmake
+++ b/Modules/FindOpenMP.cmake
@@ -230,6 +230,7 @@ function(_OPENMP_GET_FLAGS LANG FLAG_MODE OPENMP_FLAG_VAR OPENMP_LIB_NAMES_VAR)
DOC "Path to the ${_OPENMP_IMPLICIT_LIB_PLAIN} library for OpenMP"
HINTS ${OpenMP_${LANG}_IMPLICIT_LINK_DIRS}
CMAKE_FIND_ROOT_PATH_BOTH
+ NO_DEFAULT_PATH
)
endif()
mark_as_advanced(OpenMP_${_OPENMP_IMPLICIT_LIB_PLAIN}_LIBRARY)
@@ -244,6 +245,8 @@ function(_OPENMP_GET_FLAGS LANG FLAG_MODE OPENMP_FLAG_VAR OPENMP_LIB_NAMES_VAR)
find_library(OpenMP_libiomp5md_LIBRARY
NAMES "libiomp5md"
HINTS ${CMAKE_${LANG}_IMPLICIT_LINK_DIRECTORIES}
+ CMAKE_FIND_ROOT_PATH_BOTH
+ NO_DEFAULT_PATH
)
mark_as_advanced(OpenMP_libiomp5md_LIBRARY)
else()