Skip to content

Commit

Permalink
Fail early if python not found.
Browse files Browse the repository at this point in the history
  • Loading branch information
Kasper Peeters committed Sep 27, 2024
1 parent e315c92 commit 88402a7
Showing 1 changed file with 16 additions and 12 deletions.
28 changes: 16 additions & 12 deletions CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -23,6 +23,10 @@ if(POLICY CMP0167)
cmake_policy(SET CMP0167 NEW)
message(STATUS "Set CMake policy CM0167 to NEW")
endif()
if(POLICY CMP0094)
cmake_policy(SET CMP0094 NEW)
message(STATUS "Set CMake policy CM0094 to NEW (use first Python found)")
endif()

cmake_minimum_required(VERSION ${CADABRA_CMAKE_VERSION})
set(CMAKE_CXX_STANDARD 17)
Expand Down Expand Up @@ -292,19 +296,19 @@ 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/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()
find_package(Python REQUIRED COMPONENTS Interpreter Development)
endif()
# endif()
find_package(pybind11 CONFIG)
if (NOT pybind11_FOUND)
message(STATUS "Using included pybind11.")
Expand Down

0 comments on commit 88402a7

Please sign in to comment.