From 096bdef25a5290db6b808eb818eb1c2d2223639c Mon Sep 17 00:00:00 2001 From: WerWolv Date: Mon, 15 Feb 2021 12:44:38 +0100 Subject: [PATCH] Fix cmake trying to remove patch version of python even if there was none This fixes #159 --- cmake/build_helpers.cmake | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) 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}\"\\\"")