File tree Expand file tree Collapse file tree 1 file changed +15
-0
lines changed Expand file tree Collapse file tree 1 file changed +15
-0
lines changed Original file line number Diff line number Diff line change @@ -22,6 +22,21 @@ macro(mlir_configure_python_dev_packages)
2222 find_package (Python3 ${LLVM_MINIMUM_PYTHON_VERSION}
2323 COMPONENTS Interpreter ${_python_development_component} REQUIRED)
2424
25+ # We look for both Python3 and Python, the search algorithm should be
26+ # consistent, otherwise disastrous result is almost guaranteed.
27+ # Warn if the policies for treating virtual environment are not defined
28+ # consistently.
29+ # For more details check issue #126162.
30+ if (((DEFINED Python_FIND_VIRTUALENV) AND (NOT DEFINED Python3_FIND_VIRTUALENV)) OR
31+ ((NOT DEFINED Python_FIND_VIRTUALENV) AND (DEFINED Python3_FIND_VIRTUALENV)))
32+ message (WARNING "Only one of Python3_FIND_VIRTUALENV and Python_FIND_VIRTUALENV variables is defined. "
33+ "Make sure that both variables are defined and have the same value." )
34+ elseif ((DEFINED Python_FIND_VIRTUALENV) AND (DEFINED Python3_FIND_VIRTUALENV) AND
35+ (NOT Python_FIND_VIRTUALENV STREQUAL Python3_FIND_VIRTUALENV))
36+ message (WARNING "Python3_FIND_VIRTUALENV and Python_FIND_VIRTUALENV are defined differently. "
37+ "Make sure that the variables have the same values." )
38+ endif ()
39+
2540 # It's a little silly to detect Python a second time, but nanobind's cmake
2641 # code looks for Python_ not Python3_.
2742 find_package (Python ${LLVM_MINIMUM_PYTHON_VERSION}
You can’t perform that action at this time.
0 commit comments