From da1b5e89ca3806bd3e83b86c6043ee8d778c5f22 Mon Sep 17 00:00:00 2001 From: Kait Lam Date: Tue, 6 Feb 2024 12:10:51 +1000 Subject: [PATCH] cmake: fix python version comparison due to whitespace Previously, there was warnings such as: ``` CMake Warning at CMakeLists.txt:131 (message): /usr/bin/python3.11 --version is 3.11.7 , which is less then the minimum required, 3.5.2; disabling building of API. ``` The presence of whitespace turned VERSION_LESS into a lexicographic comparison, so python versions >=3.10 would incorrectly compare less. This change should fix this. --- CMakeLists.txt | 1 + 1 file changed, 1 insertion(+) diff --git a/CMakeLists.txt b/CMakeLists.txt index e176b6a7e..1c3c6f41a 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -125,6 +125,7 @@ if(GTIRB_PY_API) COMMAND "${PYTHON}" "--version" OUTPUT_VARIABLE PYTHON_VERSION ) string(REPLACE "Python" "" PYTHON_VERSION "${PYTHON_VERSION}") + string(STRIP "${PYTHON_VERSION}" PYTHON_VERSION) if("${PYTHON_VERSION}" VERSION_LESS "${PYTHON_MINIMUM_VERSION}") message(