MinGW64: FindPython3 prepends current directory to C:/msys64/mingw64/include/python3.11/patchlevel.h
FindPython3 fails on MingGW64, presumably because the current directory is prepended to the valid and existing path C:/msys64/mingw64/include/python3.11/patchlevel.h
, resulting in /home/stefan/foo/C:/msys64/mingw64/include/python3.11/patchlevel.h
:
$ /usr/bin/cmake.exe --version
cmake version 3.28.3
$ echo $PATH
/mingw64/bin:/usr/local/bin:/usr/bin:/bin:/opt/bin:/c/Windows/System32:/c/Windows:/c/Windows/System32/Wbem:/c/Windows/System32/WindowsPowerShell/v1.0/:/usr/bin/site_perl:/usr/bin/vendor_perl:/usr/bin/core_perl
$ cat CMakeLists.txt
cmake_minimum_required(VERSION 3.19)
project(
foo
VERSION 0.1)
find_package(Python3 OPTIONAL_COMPONENTS Interpreter Development.Module)
$ /usr/bin/cmake.exe .
-- The C compiler identification is GNU 13.2.0
-- The CXX compiler identification is GNU 13.2.0
-- Detecting C compiler ABI info
-- Detecting C compiler ABI info - done
-- Check for working C compiler: /mingw64/bin/cc.exe - skipped
-- Detecting C compile features
-- Detecting C compile features - done
-- Detecting CXX compiler ABI info
-- Detecting CXX compiler ABI info - done
-- Check for working CXX compiler: /mingw64/bin/c++.exe - skipped
-- Detecting CXX compile features
-- Detecting CXX compile features - done
CMake Error at /usr/share/cmake/Modules/FindPython/Support.cmake:703 (file):
file STRINGS file
"/home/stefan/foo/C:/msys64/mingw64/include/python3.11/patchlevel.h" cannot
be read.
Call Stack (most recent call first):
/usr/share/cmake/Modules/FindPython/Support.cmake:3569 (_python_get_version)
/usr/share/cmake/Modules/FindPython3.cmake:545 (include)
CMakeLists.txt:7 (find_package)
CMake Error at /usr/share/cmake/Modules/FindPython/Support.cmake:708 (list):
list GET given empty list
Call Stack (most recent call first):
/usr/share/cmake/Modules/FindPython/Support.cmake:3569 (_python_get_version)
/usr/share/cmake/Modules/FindPython3.cmake:545 (include)
CMakeLists.txt:7 (find_package)
CMake Error at /usr/share/cmake/Modules/FindPython/Support.cmake:709 (list):
list GET given empty list
Call Stack (most recent call first):
/usr/share/cmake/Modules/FindPython/Support.cmake:3569 (_python_get_version)
/usr/share/cmake/Modules/FindPython3.cmake:545 (include)
CMakeLists.txt:7 (find_package)
CMake Error at /usr/share/cmake/Modules/FindPython/Support.cmake:710 (list):
list GET given empty list
Call Stack (most recent call first):
/usr/share/cmake/Modules/FindPython/Support.cmake:3569 (_python_get_version)
/usr/share/cmake/Modules/FindPython3.cmake:545 (include)
CMakeLists.txt:7 (find_package)
-- Found Python3: (found version "3.11.8") found components: Interpreter missing components: Development.Module
-- Configuring incomplete, errors occurred!