5 # Find cython executable.
10 # This module defines the following variables:
14 # ``CYTHON_EXECUTABLE``
18 include(${CMAKE_ROOT}/Modules/FindPackageHandleStandardArgs.cmake)
20 if(EXISTS "${Python_EXECUTABLE}")
21 execute_process(COMMAND ${Python_EXECUTABLE} -c "import Cython; print(Cython.__version__)"
22 ERROR_QUIET OUTPUT_STRIP_TRAILING_WHITESPACE OUTPUT_VARIABLE CYTHON_VERSION
27 set(CYTHON_EXECUTABLE ${Python_EXECUTABLE} -m cython)
29 find_program(CYTHON_EXECUTABLE NAMES cython)
30 mark_as_advanced(CYTHON_EXECUTABLE)
34 if(NOT CYTHON_VERSION AND EXISTS "${CYTHON_EXECUTABLE}")
35 execute_process(COMMAND ${CYTHON_EXECUTABLE} --version OUTPUT_QUIET ERROR_VARIABLE CYTHON_VERSION)
36 string(REGEX REPLACE ".*version ([^\n ]+).*" "\\1" CYTHON_VERSION "${CYTHON_VERSION}")
39 find_package_handle_standard_args(Cython