From 19d3bf37fef9ae5d604821d4422eb53310a7f82e Mon Sep 17 00:00:00 2001 From: mzn Date: Mon, 20 Aug 2018 19:56:37 +0300 Subject: [PATCH] Fix version parsing. --- CMakeCommon/SalomeMacros.cmake | 10 +++++++--- 1 file changed, 7 insertions(+), 3 deletions(-) diff --git a/CMakeCommon/SalomeMacros.cmake b/CMakeCommon/SalomeMacros.cmake index 970f7c104..686c8a08b 100644 --- a/CMakeCommon/SalomeMacros.cmake +++ b/CMakeCommon/SalomeMacros.cmake @@ -965,9 +965,13 @@ ENDMACRO(SALOME_CONFIGURE_PREPARE) # MACRO(SALOME_EXTRACT_VERSION version_string major minor patch) IF(${version_string} MATCHES "[0-9]+[^0-9]*\\.[0-9]+[^0-9]*\\.[0-9]+[^0-9]*") - STRING(REGEX REPLACE "^([0-9]+)[^0-9]*\\.[0-9]+[^0-9]*\\.[0-9]+[^0-9]*" "\\1" ${major} "${version_string}") - STRING(REGEX REPLACE "^[0-9]+[^0-9]*\\.([0-9]+)[^0-9]*\\.[0-9]+[^0-9]*" "\\1" ${minor} "${version_string}") - STRING(REGEX REPLACE "^[0-9]+[^0-9]*\\.[0-9]+[^0-9]*\\.([0-9]+)[^0-9]*" "\\1" ${patch} "${version_string}") + STRING(REGEX REPLACE "^([0-9]+)[^0-9]*\\.[0-9]+[^0-9]*\\.[0-9]+[^0-9]*" "\\1" major "${version_string}") + STRING(REGEX REPLACE "^[0-9]+[^0-9]*\\.([0-9]+)[^0-9]*\\.[0-9]+[^0-9]*" "\\1" minor "${version_string}") + STRING(REGEX REPLACE "^[0-9]+[^0-9]*\\.[0-9]+[^0-9]*\\.([0-9]+)[^0-9]*" "\\1" patch "${version_string}") + ELSEIF(${version_string} MATCHES "[0-9]+[^0-9]*\\.[0-9]+[^0-9]*") + STRING(REGEX REPLACE "^([0-9]+)[^0-9]*\\.[0-9]+[^0-9]*" "\\1" major "${version_string}") + STRING(REGEX REPLACE "^[0-9]+[^0-9]*\\.([0-9]+)[^0-9]*" "\\1" minor "${version_string}") + SET(PATCH "0") ELSE() MESSAGE("MACRO(SALOME_EXTRACT_VERSION ${version_string} ${major} ${minor} ${patch}") MESSAGE(FATAL_ERROR "Problem parsing version string, I can't parse it properly.") -- 2.39.2