diff --git a/cmake/hal_cmake_tools.cmake b/cmake/hal_cmake_tools.cmake index 0e7a881e88d..8fc0f57c15d 100644 --- a/cmake/hal_cmake_tools.cmake +++ b/cmake/hal_cmake_tools.cmake @@ -13,7 +13,9 @@ function(hal_get_version) if(VERSION_LIST STREQUAL "") file(READ ${CMAKE_SOURCE_DIR}/CURRENT_VERSION VERSION_FILE) message(VERBOSE "VERSION_FILE: ${VERSION_FILE}") - string(REGEX MATCHALL "v([0-9]+)\.([0-9]+)\.([0-9]+)" match ${VERSION_FILE}) + set(VERSION_FILE "v${VERSION_FILE}") + string(STRIP ${VERSION_FILE} VERSION_FILE) + string(REGEX MATCHALL "v+([0-9]+)\.([0-9]+)\.([0-9]+)" match ${VERSION_FILE}) if(NOT ${match} EQUAL "") set(HAL_VERSION_RETURN ${VERSION_FILE} PARENT_SCOPE) message(STATUS "HAL_VERSION_RETURN: ${HAL_VERSION_RETURN}") @@ -232,4 +234,4 @@ macro(configure_files src_dir dst_dir extension) @ONLY) endif(NOT IS_DIRECTORY ${file_path_to_copy}) endforeach(file_to_copy) -endmacro(configure_files) \ No newline at end of file +endmacro(configure_files)