[MLIR] [CMake/Python] Fix ignored Python3_EXECUTABLE
authorJohn Demme <john.demme@microsoft.com>
Thu, 10 Mar 2022 15:43:43 +0000 (07:43 -0800)
committerJohn Demme <john.demme@microsoft.com>
Thu, 10 Mar 2022 15:43:43 +0000 (07:43 -0800)
On Windows (at least), cmake ignores Python3_EXECUTABLE unless the
'Interpreter' component is being found. If the user is specifying a
different version than the latest installed (say, 3.8 vs 3.9) with the
Python3_EXECUTABLE, cmake was using a combination of the newest version
and the desired version. Mitigated by adding 'Interpreter' in the first
invocation like the second one.

mlir/cmake/modules/MLIRDetectPythonEnv.cmake

index cb1fea1..7cbad49 100644 (file)
@@ -29,7 +29,7 @@ macro(mlir_configure_python_dev_packages)
       # Development.Module in some environments. However, in other environments
       # it may interfere with the subsequent search for Development.Module.
       find_package(Python3 ${LLVM_MINIMUM_PYTHON_VERSION}
-        COMPONENTS Development)
+        COMPONENTS Interpreter Development)
     endif()
     set(_python_development_component Development.Module)
   endif()