Skip to content

Commit dddd823

Browse files
henryiiijcfr
andcommitted
chore: Simplify setting of CYTHON_VERSION
Co-authored-by: Jean-Christophe Fillion-Robin <[email protected]>
1 parent c306737 commit dddd823

File tree

1 file changed

+6
-8
lines changed

1 file changed

+6
-8
lines changed

src/cython_cmake/cmake/FindCython.cmake

Lines changed: 6 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -56,7 +56,7 @@ else()
5656
endif()
5757

5858
if(CYTHON_EXECUTABLE)
59-
set(CYTHON_version_command ${CYTHON_EXECUTABLE} --version)
59+
set(CYTHON_version_command "${CYTHON_EXECUTABLE}" --version)
6060

6161
execute_process(COMMAND ${CYTHON_version_command}
6262
OUTPUT_VARIABLE CYTHON_version_output
@@ -69,14 +69,12 @@ if(CYTHON_EXECUTABLE)
6969
set(_error_msg "Command \"${CYTHON_version_command}\" failed with")
7070
set(_error_msg "${_error_msg} output:\n${CYTHON_version_error}")
7171
message(SEND_ERROR "${_error_msg}")
72+
elseif("${CYTHON_version_output}" MATCHES "^[Cc]ython version ([^,]+)")
73+
set(CYTHON_VERSION "${CMAKE_MATCH_1}")
74+
elseif("${CYTHON_version_error}" MATCHES "^[Cc]ython version ([^,]+)")
75+
set(CYTHON_VERSION "${CMAKE_MATCH_1}")
7276
else()
73-
if("${CYTHON_version_output}" MATCHES "^[Cc]ython version ([^,]+)")
74-
set(CYTHON_VERSION "${CMAKE_MATCH_1}")
75-
else()
76-
if("${CYTHON_version_error}" MATCHES "^[Cc]ython version ([^,]+)")
77-
set(CYTHON_VERSION "${CMAKE_MATCH_1}")
78-
endif()
79-
endif()
77+
message(SEND_ERROR "Invalid Cython version output")
8078
endif()
8179
endif()
8280

0 commit comments

Comments
 (0)