diff --git a/cmake/build_helpers.cmake b/cmake/build_helpers.cmake index f81312949..98f19a678 100644 --- a/cmake/build_helpers.cmake +++ b/cmake/build_helpers.cmake @@ -49,7 +49,12 @@ macro(findLibraries) endif() string(REPLACE "." ";" PYTHON_VERSION_MAJOR_MINOR ${Python_VERSION}) - list(REMOVE_AT PYTHON_VERSION_MAJOR_MINOR 2) + + list(LENGTH PYTHON_VERSION_MAJOR_MINOR PYTHON_VERSION_COMPONENT_COUNT) + + if (PYTHON_VERSION_COMPONENT_COUNT EQUAL 3) + list(REMOVE_AT PYTHON_VERSION_MAJOR_MINOR 2) + endif () list(JOIN PYTHON_VERSION_MAJOR_MINOR "." PYTHON_VERSION_MAJOR_MINOR) set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} ${CMAKE_C_FLAGS} -DPYTHON_VERSION_MAJOR_MINOR=\"\\\"${PYTHON_VERSION_MAJOR_MINOR}\"\\\"")