cmake: Trim IDF_VER to fit a 32-bit field

This commit is contained in:
Konstantin Kondrashov 2019-03-13 20:04:43 +08:00
parent 53208f6324
commit f8ca296438

View File

@ -223,11 +223,13 @@ endfunction()
function(idf_get_git_revision)
git_describe(IDF_VER_GIT "${IDF_PATH}")
if(EXISTS "${IDF_PATH}/version.txt")
file(STRINGS "${IDF_PATH}/version.txt" IDF_VER)
file(STRINGS "${IDF_PATH}/version.txt" IDF_VER_T)
set_property(DIRECTORY APPEND PROPERTY CMAKE_CONFIGURE_DEPENDS "${IDF_PATH}/version.txt")
else()
set(IDF_VER ${IDF_VER_GIT})
set(IDF_VER_T ${IDF_VER_GIT})
endif()
# cut IDF_VER to required 32 characters.
string(SUBSTRING "${IDF_VER_T}" 0 31 IDF_VER)
message(STATUS "IDF_VER: ${IDF_VER}")
add_definitions(-DIDF_VER=\"${IDF_VER}\")
git_submodule_check("${IDF_PATH}")