From e0b320ee35adf2327595d0a1c1b9b548ff8cc2fb Mon Sep 17 00:00:00 2001 From: Michael Kuron Date: Mon, 12 Nov 2018 10:19:18 +0100 Subject: [PATCH] Fix Cython detection on Fedora 29 --- cmake/FindCython.cmake | 15 ++++++++++----- 1 file changed, 10 insertions(+), 5 deletions(-) diff --git a/cmake/FindCython.cmake b/cmake/FindCython.cmake index 75c36b0f202..e8774d947d5 100644 --- a/cmake/FindCython.cmake +++ b/cmake/FindCython.cmake @@ -41,16 +41,21 @@ else() endif() # Check version -if(CYTHON_EXECUTABLE) - execute_process(COMMAND ${CYTHON_EXECUTABLE} -V - ERROR_VARIABLE CYTHON_OUTPUT OUTPUT_QUIET) - string(REGEX REPLACE "^Cython version ([0-9]+\\.[0-9]+).*" "\\1" CYTHON_VERSION "${CYTHON_OUTPUT}") +if(NOT CYTHON_EXECUTABLE) + set(CYTHON_EXECUTABLE ${PYTHON_EXECUTABLE} -m cython) +endif() +execute_process(COMMAND ${CYTHON_EXECUTABLE} -V + ERROR_VARIABLE CYTHON_OUTPUT RESULT_VARIABLE CYTHON_STATUS OUTPUT_QUIET) +if(CYTHON_STATUS EQUAL 0) + string(REGEX REPLACE "^Cython version ([0-9]+\\.[0-9\\.]+).*" "\\1" CYTHON_VERSION "${CYTHON_OUTPUT}") if(${CYTHON_VERSION} VERSION_LESS ${CYTHON_REQUIRED_VERSION}) - message(FATAL_ERROR "Espresso needs at least Cython version ${CYTHON_REQUIRED_VERSION}, found verson ${CYTHON_VERSION}") + message(FATAL_ERROR "Espresso needs at least Cython version ${CYTHON_REQUIRED_VERSION}, found version ${CYTHON_VERSION}") else() message(STATUS "Found Cython version ${CYTHON_VERSION}") endif() +else() + message(FATAL_ERROR "Espresso needs at least Cython version ${CYTHON_REQUIRED_VERSION}, but could not find it") endif() include( FindPackageHandleStandardArgs )