summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorBrad King <brad.king@kitware.com>2024-08-27 13:21:11 (GMT)
committerKitware Robot <kwrobot@kitware.com>2024-08-27 13:21:32 (GMT)
commit7400c1e9bb0ea8f3b1a795c4b496004dbf316d15 (patch)
tree57ca111f45682c86d859e8d8a580369cd00eb4a9
parentbfa7a5445bbce20363e58443bbccf40e2721aeb3 (diff)
parent516124ea23514ff9d7d7d9729031bf0b1e77b682 (diff)
downloadCMake-7400c1e9bb0ea8f3b1a795c4b496004dbf316d15.zip
CMake-7400c1e9bb0ea8f3b1a795c4b496004dbf316d15.tar.gz
CMake-7400c1e9bb0ea8f3b1a795c4b496004dbf316d15.tar.bz2
Merge topic 'FindPython-numpy-mkl' into release-3.30
516124ea23 FindPython: fix regression of NumPy detection with Intel MKL library Acked-by: Kitware Robot <kwrobot@kitware.com> Acked-by: buildbot <buildbot@kitware.com> Merge-request: !9776
-rw-r--r--Modules/FindPython/Support.cmake17
1 files changed, 8 insertions, 9 deletions
diff --git a/Modules/FindPython/Support.cmake b/Modules/FindPython/Support.cmake
index 1386117..294e7d9 100644
--- a/Modules/FindPython/Support.cmake
+++ b/Modules/FindPython/Support.cmake
@@ -3903,11 +3903,12 @@ if ("NumPy" IN_LIST ${_PYTHON_PREFIX}_FIND_COMPONENTS AND ${_PYTHON_PREFIX}_Inte
# Workaround Intel MKL library outputting a message in stdout, which cause
# incorrect detection of numpy.get_include() and numpy.__version__
- # See https://github.com/numpy/numpy/issues/23775
- if(DEFINED ENV{MKL_ENABLE_INSTRUCTIONS})
- set(_${_PYTHON_PREFIX}_BACKUP_ENV_VAR_MKL_ENABLE_INSTRUCTIONS ENV{MKL_ENABLE_INSTRUCTIONS})
+ # See https://github.com/numpy/numpy/issues/23775 and
+ # https://gitlab.kitware.com/cmake/cmake/-/issues/26240
+ if(NOT DEFINED ENV{MKL_ENABLE_INSTRUCTIONS})
+ set(_${_PYTHON_PREFIX}_UNSET_ENV_VAR_MKL_ENABLE_INSTRUCTIONS YES)
+ set(ENV{MKL_ENABLE_INSTRUCTIONS} "SSE4_2")
endif()
- set(ENV{MKL_ENABLE_INSTRUCTIONS} "SSE4_2")
if (NOT _${_PYTHON_PREFIX}_NumPy_INCLUDE_DIR)
execute_process(COMMAND ${${_PYTHON_PREFIX}_INTERPRETER_LAUNCHER} "${_${_PYTHON_PREFIX}_EXECUTABLE}" -c
@@ -3949,11 +3950,9 @@ if ("NumPy" IN_LIST ${_PYTHON_PREFIX}_FIND_COMPONENTS AND ${_PYTHON_PREFIX}_Inte
set (${_PYTHON_PREFIX}_NumPy_FOUND FALSE)
endif()
- # Restore previous value of MKL_ENABLE_INSTRUCTIONS
- if(DEFINED _${_PYTHON_PREFIX}_BACKUP_ENV_VAR_MKL_ENABLE_INSTRUCTIONS)
- set(ENV{MKL_ENABLE_INSTRUCTIONS} ${_${_PYTHON_PREFIX}_BACKUP_ENV_VAR_MKL_ENABLE_INSTRUCTIONS})
- unset(_${_PYTHON_PREFIX}_BACKUP_ENV_VAR_MKL_ENABLE_INSTRUCTIONS)
- else()
+ # Unset MKL_ENABLE_INSTRUCTIONS if set by us
+ if(DEFINED _${_PYTHON_PREFIX}_UNSET_ENV_VAR_MKL_ENABLE_INSTRUCTIONS)
+ unset(_${_PYTHON_PREFIX}_UNSET_ENV_VAR_MKL_ENABLE_INSTRUCTIONS)
unset(ENV{MKL_ENABLE_INSTRUCTIONS})
endif()