]> granicus.if.org Git - esp-idf/commitdiff
cmake: Trim IDF_VER to fit a 32-bit field
authorKonstantin Kondrashov <konstantin@espressif.com>
Wed, 13 Mar 2019 12:04:43 +0000 (20:04 +0800)
committerKonstantin Kondrashov <konstantin@espressif.com>
Wed, 13 Mar 2019 12:04:43 +0000 (20:04 +0800)
tools/cmake/idf_functions.cmake

index 3ea818ec80903db8d2823b6d9ffbbbce8fef99d1..01035a0b17f9c4cfce37095a26c8b9c70f6470ec 100644 (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}")