Kaynağa Gözat

Merge branch 'bugfix/fix_project_ver_issue' into 'master'

CMake: fix retrieving PROJECT_VER

See merge request espressif/esp-idf!5842
Angus Gratton 6 yıl önce
ebeveyn
işleme
f85ba3516f

+ 1 - 1
docs/en/api-guides/build-system.rst

@@ -949,7 +949,7 @@ The call requires the target chip to be specified with *target* argument. Option
 
 - PROJECT_DIR - directory of the project; defaults to CMAKE_SOURCE_DIR
 - PROJECT_NAME - name of the project; defaults to CMAKE_PROJECT_NAME
-- PROJECT_VER - version/revision of the project; defaults to "0.0.0"
+- PROJECT_VER - version/revision of the project; defaults to "1"
 - SDKCONFIG - output path of generated sdkconfig file; defaults to PROJECT_DIR/sdkconfig or CMAKE_SOURCE_DIR/sdkconfig depending if PROJECT_DIR is set
 - SDKCONFIG_DEFAULTS - defaults file to use for the build; defaults to empty
 - BUILD_DIR - directory to place ESP-IDF build-related artifacts, such as generated binaries, text files, components; defaults to CMAKE_BINARY_DIR

+ 3 - 3
tools/cmake/build.cmake

@@ -295,7 +295,7 @@ endmacro()
 #
 macro(__build_set_default var default)
     set(_var __${var})
-    if(${_var})
+    if(NOT "${_var}" STREQUAL "")
         idf_build_set_property(${var} "${${_var}}")
     else()
         idf_build_set_property(${var} "${default}")
@@ -330,7 +330,7 @@ endfunction()
 # @param[in, optional] PROJECT_DIR (single value) directory of the main project the buildsystem
 #                      is processed for; defaults to CMAKE_SOURCE_DIR
 # @param[in, optional] PROJECT_VER (single value) version string of the main project; defaults
-#                      to 0.0.0
+#                      to 1
 # @param[in, optional] PROJECT_NAME (single value) main project name, defaults to CMAKE_PROJECT_NAME
 # @param[in, optional] SDKCONFIG (single value) sdkconfig output path, defaults to PROJECT_DIR/sdkconfig
 #                       if PROJECT_DIR is set and CMAKE_SOURCE_DIR/sdkconfig if not
@@ -366,7 +366,7 @@ macro(idf_build_process target)
 
     __build_set_default(PROJECT_DIR ${CMAKE_SOURCE_DIR})
     __build_set_default(PROJECT_NAME ${CMAKE_PROJECT_NAME})
-    __build_set_default(PROJECT_VER "0.0.0")
+    __build_set_default(PROJECT_VER 1)
     __build_set_default(BUILD_DIR ${CMAKE_BINARY_DIR})
 
     idf_build_get_property(project_dir PROJECT_DIR)

+ 0 - 1
tools/cmake/project.cmake

@@ -40,7 +40,6 @@ function(__project_get_revision var)
             else()
                 message(STATUS "Project is not inside a git repository, \
                         will not use 'git describe' to determine PROJECT_VER.")
-                set(PROJECT_VER "1")
             endif()
         endif()
     endif()