FindPython: Fix finding NumPy with oneMKL 2026.0

Fix commit 516124ea23 (FindPython: fix regression of NumPy detection
with Intel MKL library, 2024-08-26, v3.30.3~4^2) to apply only on macOS.
It is not needed on other platforms, and oneMKL 2026.0 deprecates SSE4.2.
This commit is contained in:
Viraj Malia
2026-03-06 14:14:21 -05:00
committed by Brad King
parent 3f44eea73c
commit cf54a293ab
+7 -7
View File
@@ -4207,13 +4207,13 @@ if ("NumPy" IN_LIST ${_PYTHON_BASE}_FIND_COMPONENTS AND ${_PYTHON_PREFIX}_Interp
endif()
endif()
# 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 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")
# Work around Intel MKL message to stdout on macOS:
# https://github.com/numpy/numpy/issues/23775
if(CMAKE_SYSTEM_NAME STREQUAL "Darwin")
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()
endif()
if (NOT _${_PYTHON_PREFIX}_NumPy_INCLUDE_DIR)