mirror of
https://github.com/Kitware/CMake.git
synced 2025-12-31 10:50:16 -06:00
FindOpenMP: Fix support for Intel on Windows
The change in commit v3.11.0-rc1~334^2 (FindOpenMP: Use NO_DEFAULT_PATH
where appropriate, 2017-11-15) broke partial support for Intel on Windows.
Since `OpenMP_${LANG}_IMPLICIT_LINK_DIRS` is empty for this compiler
the `find_library` call without `NO_DEFAULT_PATH` worked accidentally
in environments with the needed libraries in the search path already.
Fix support for Intel on Windows by simply removing our explicit search
for the `libiomp5md` library. In cases that it is needed, the compiler
already inserts metadata in `.obj` files to tell the MSVC linker to use
the library.
Suggested-by: Christian Pfeiffer <cpfeiffer@live.de>
Fixes: #17910
This commit is contained in:
@@ -240,19 +240,10 @@ function(_OPENMP_GET_FLAGS LANG FLAG_MODE OPENMP_FLAG_VAR OPENMP_LIB_NAMES_VAR)
|
||||
endforeach()
|
||||
set("${OPENMP_LIB_NAMES_VAR}" "${_OPENMP_LIB_NAMES}" PARENT_SCOPE)
|
||||
else()
|
||||
# The Intel compiler on windows has no verbose mode, so we need to treat it explicitly
|
||||
if("${CMAKE_${LANG}_COMPILER_ID}" STREQUAL "Intel" AND "${CMAKE_SYSTEM_NAME}" STREQUAL "Windows")
|
||||
set("${OPENMP_LIB_NAMES_VAR}" "libiomp5md" PARENT_SCOPE)
|
||||
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()
|
||||
set("${OPENMP_LIB_NAMES_VAR}" "" PARENT_SCOPE)
|
||||
endif()
|
||||
# We do not know how to extract implicit OpenMP libraries for this compiler.
|
||||
# Assume that it handles them automatically, e.g. the Intel Compiler on
|
||||
# Windows should put the dependency in its object files.
|
||||
set("${OPENMP_LIB_NAMES_VAR}" "" PARENT_SCOPE)
|
||||
endif()
|
||||
break()
|
||||
endif()
|
||||
|
||||
Reference in New Issue
Block a user