From fffa589437daad17f6098e9fef8e6f8dd632552d Mon Sep 17 00:00:00 2001 From: Kasper Peeters Date: Fri, 27 Sep 2024 22:00:19 +0100 Subject: [PATCH] Fail early if python not found. --- CMakeLists.txt | 25 +++++++++++++------------ 1 file changed, 13 insertions(+), 12 deletions(-) diff --git a/CMakeLists.txt b/CMakeLists.txt index 1957a8aa5e..22f24aeeda 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -296,19 +296,20 @@ print_header("Configuring Python") include(GNUInstallDirs) set(Python_POSTFIX "3") -# if(WIN32) -# # Set a hint for finding Python, so we hopefully get the msys -# # version. This otherwise breaks on github runners. -# execute_process( -# COMMAND cygpath -m /usr/bin/ -# OUTPUT_VARIABLE PYTHON_HINT -# OUTPUT_STRIP_TRAILING_WHITESPACE -# ) -# message(STATUS "Using Python hint ${PYTHON_HINT}") -# find_package(Python REQUIRED COMPONENTS Interpreter Development HINTS ${PYTHON_HINT}) -# else() +if(WIN32) + # Set a hint for finding Python, so we hopefully get the msys + # version. This otherwise breaks on github runners. + execute_process( + COMMAND cygpath -m /usr/lib/python3.11/ + OUTPUT_VARIABLE PYTHON_HINT + OUTPUT_STRIP_TRAILING_WHITESPACE + ) + message(STATUS "Using Python root dir ${PYTHON_HINT}") + set(Python_ROOT_DIR ${PYTHON_HINT}) find_package(Python REQUIRED COMPONENTS Interpreter Development) -# endif() +else() + find_package(Python REQUIRED COMPONENTS Interpreter Development) +endif() find_package(pybind11 CONFIG) if (NOT pybind11_FOUND) message(STATUS "Using included pybind11.")