diff --git a/cmake/FindCython.cmake b/cmake/FindCython.cmake index e2995bff3..23afb00e6 100644 --- a/cmake/FindCython.cmake +++ b/cmake/FindCython.cmake @@ -4,8 +4,9 @@ # # This code sets the following variables: # -# CYTHON_EXECUTABLE # CYTHON_FOUND +# CYTHON_PATH +# CYTHON_EXECUTABLE # CYTHON_VERSION # # See also UseCython.cmake @@ -38,6 +39,15 @@ if ( PYTHONINTERP_FOUND ) ) endif () +# RESULT=0 means ok +if ( NOT RESULT ) + get_filename_component( _python_path ${PYTHON_EXECUTABLE} PATH ) + find_program( CYTHON_EXECUTABLE + NAMES cython cython.bat cython3 + HINTS ${_python_path} + ) +endif () + # RESULT=0 means ok if ( NOT RESULT ) execute_process( COMMAND "${PYTHON_EXECUTABLE}" "-c" @@ -59,6 +69,7 @@ find_package_handle_standard_args( Cython CYTHON_FOUND REQUIRED_VARS CYTHON_PATH + CYTHON_EXECUTABLE VERSION_VAR CYTHON_VERSION ) diff --git a/cmake/GtsamCythonWrap.cmake b/cmake/GtsamCythonWrap.cmake index 50d2b16da..ec297955b 100644 --- a/cmake/GtsamCythonWrap.cmake +++ b/cmake/GtsamCythonWrap.cmake @@ -52,7 +52,7 @@ function(pyx_to_cpp target pyx_file generated_cpp include_dirs) add_custom_command( OUTPUT ${generated_cpp} COMMAND - cython -v --cplus ${includes_for_cython} ${pyx_file} -o ${generated_cpp} + ${CYTHON_EXECUTABLE} -a -v --cplus ${includes_for_cython} ${pyx_file} -o ${generated_cpp} VERBATIM) add_custom_target(${target} ALL DEPENDS ${generated_cpp}) endfunction()