Skip to content

Commit 6b991c3

Browse files
henryiiijcfr
andcommitted
feat: support UseCython by itself
Co-authored-by: Jean-Christophe Fillion-Robin <[email protected]>
1 parent f1eb121 commit 6b991c3

File tree

1 file changed

+12
-1
lines changed

1 file changed

+12
-1
lines changed

src/cython_cmake/cmake/UseCython.cmake

Lines changed: 12 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -77,6 +77,16 @@ function(Cython_compile_pyx)
7777
${ARGN}
7878
)
7979

80+
if(DEFINED CYTHON_EXECUTABLE)
81+
set(_cython_command "${CYTHON_EXECUTABLE}")
82+
elseif(DEFINED Python_EXECUTABLE)
83+
set(_cython_command "${Python_EXECUTABLE}" -m cython)
84+
elseif(DEFINED Python3_EXECUTABLE)
85+
set(_cython_command "${Python3_EXECUTABLE}" -m cython)
86+
else()
87+
message(FATAL_ERROR "Cython executable not found")
88+
endif()
89+
8090
# Get source file location
8191
set(_source_files ${_args_UNPARSED_ARGUMENTS})
8292

@@ -125,7 +135,8 @@ function(Cython_compile_pyx)
125135
# Add the command to run the compiler.
126136
add_custom_command(
127137
OUTPUT ${generated_file}
128-
COMMAND ${CYTHON_EXECUTABLE}
138+
COMMAND
139+
${_cython_command}
129140
ARGS
130141
${_language_arg}
131142
${_args_CYTHON_ARGS}

0 commit comments

Comments
 (0)