1
0
Fork 0
mirror of https://github.com/iNavFlight/inav.git synced 2025-07-13 03:19:58 +03:00

build: deduplicate version number

Make the version in the CMakeLists.txt the canonical one. Instead
of redefining it in version.h, use command line flags to pass
-DFC_VERSION_{MAJOR,MINOR,PATCH_LEVEL}
This commit is contained in:
Alberto García Hierro 2020-12-04 20:13:02 +00:00
parent 121177fc8a
commit 930a60006a
3 changed files with 7 additions and 5 deletions

View file

@ -58,6 +58,12 @@ set(FIRMWARE_VERSION ${PROJECT_VERSION})
option(WARNINGS_AS_ERRORS "Make all warnings into errors") option(WARNINGS_AS_ERRORS "Make all warnings into errors")
message("-- toolchain: ${TOOLCHAIN}, WARNINGS_AS_ERRORS: ${WARNINGS_AS_ERRORS}") message("-- toolchain: ${TOOLCHAIN}, WARNINGS_AS_ERRORS: ${WARNINGS_AS_ERRORS}")
set(COMMON_COMPILE_DEFINITIONS
FC_VERSION_MAJOR=${CMAKE_PROJECT_VERSION_MAJOR}
FC_VERSION_MINOR=${CMAKE_PROJECT_VERSION_MINOR}
FC_VERSION_PATCH_LEVEL=${CMAKE_PROJECT_VERSION_PATCH}
)
include(settings) include(settings)
include(openocd) include(openocd)
include(svd) include(svd)

View file

@ -304,7 +304,7 @@ function(target_stm32)
set(target_include_directories ${args_INCLUDE_DIRECTORIES}) set(target_include_directories ${args_INCLUDE_DIRECTORIES})
set(target_definitions ${STM32_DEFINITIONS}) set(target_definitions ${STM32_DEFINITIONS} ${COMMON_COMPILE_DEFINITIONS})
get_stm32_target_features(features "${CMAKE_CURRENT_SOURCE_DIR}" ${name}) get_stm32_target_features(features "${CMAKE_CURRENT_SOURCE_DIR}" ${name})
set_property(TARGET ${elf_target} PROPERTY FEATURES ${features}) set_property(TARGET ${elf_target} PROPERTY FEATURES ${features})

View file

@ -15,10 +15,6 @@
* along with Cleanflight. If not, see <http://www.gnu.org/licenses/>. * along with Cleanflight. If not, see <http://www.gnu.org/licenses/>.
*/ */
#define FC_VERSION_MAJOR 2 // increment when a major release is made (big new feature, etc)
#define FC_VERSION_MINOR 7 // increment when a minor release is made (small new feature, change etc)
#define FC_VERSION_PATCH_LEVEL 0 // increment when a bug is fixed
#define STR_HELPER(x) #x #define STR_HELPER(x) #x
#define STR(x) STR_HELPER(x) #define STR(x) STR_HELPER(x)
#define FC_VERSION_STRING STR(FC_VERSION_MAJOR) "." STR(FC_VERSION_MINOR) "." STR(FC_VERSION_PATCH_LEVEL) #define FC_VERSION_STRING STR(FC_VERSION_MAJOR) "." STR(FC_VERSION_MINOR) "." STR(FC_VERSION_PATCH_LEVEL)