Skip to content

Commit 9a3f3b7

Browse files
committed
feat: support UseCython by itself
Signed-off-by: Henry Schreiner <[email protected]>
1 parent 87c95c2 commit 9a3f3b7

File tree

1 file changed

+11
-2
lines changed

1 file changed

+11
-2
lines changed

src/cython_cmake/cmake/UseCython.cmake

Lines changed: 11 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -76,7 +76,6 @@ if(CMAKE_VERSION VERSION_LESS "3.7")
7676
message(FATAL_ERROR "CMake 3.7 required for DEPFILE")
7777
endif()
7878

79-
8079
function(Cython_compile_pyx)
8180
cmake_parse_arguments(
8281
PARSE_ARGV 0
@@ -92,6 +91,16 @@ function(Cython_compile_pyx)
9291
endif()
9392
list(GET ALL_INPUT 0 INPUT)
9493

94+
if(DEFINED CYTHON_EXECUTABLE)
95+
set(_cython_command "\"${CYTHON_EXECUTABLE}\"")
96+
elseif(DEFINED Python_EXECUTABLE)
97+
set(_cython_command "\"${Python_EXECUTABLE}\" -m cython")
98+
elseif(DEFINED Python3_EXECUTABLE)
99+
set(_cython_command "\"${Python3_EXECUTABLE}\" -m cython")
100+
else()
101+
message(FATAL_ERROR "Cython executable not found")
102+
endif()
103+
95104
# Set target language
96105
if(NOT CYTHON_LANGUAGE)
97106
get_property(_languages GLOBAL PROPERTY ENABLED_LANGUAGES)
@@ -164,7 +173,7 @@ function(Cython_compile_pyx)
164173
"${CYTHON_OUTPUT}"
165174
"${depfile_path}"
166175
COMMAND
167-
Cython::Cython
176+
${_cython_command}
168177
${language_arg}
169178
${CYTHON_CYTHON_ARGS}
170179
--depfile

0 commit comments

Comments
 (0)