Skip to content

Commit a52d814

Browse files
committed
Add extra version information to avrdude output
Some downstream projects build avrdude and want to add their own version information to the avrdude version. This adds a clean way to do that without patching for both cmake and automake based builds: cmake -DEXTRA_VERSION:STRING=-arduino.1-rc1 ../configure EXTRA_VERSION=-arduino.1-rc1 After building avrdude, the last line of "avrdude -?" will now look similar to the following, depending on whether you are building an avrdude git checkout or an avrdude release: avrdude version 8.0-20240901-arduino.1-rc1 (30e19f2), https://github.com/avrdudes/avrdude avrdude version 8.1-arduino.1-rc1 (30e19f2), https://github.com/avrdudes/avrdude
1 parent 30e19f2 commit a52d814

File tree

2 files changed

+6
-4
lines changed

2 files changed

+6
-4
lines changed

CMakeLists.txt

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -49,7 +49,7 @@ include(FindPackageMessage)
4949
include(GNUInstallDirs)
5050

5151
set(CONFIG_DIR "${CMAKE_INSTALL_FULL_SYSCONFDIR}")
52-
set(AVRDUDE_FULL_VERSION ${CMAKE_PROJECT_VERSION})
52+
set(AVRDUDE_FULL_VERSION "${CMAKE_PROJECT_VERSION}${EXTRA_VERSION}")
5353

5454
# =====================================
5555
# Get Git commit info
@@ -91,7 +91,7 @@ if(Git_FOUND)
9191

9292
# If the commit is not tagged, include the date and commit hash in the full version string.
9393
if(NOT GIT_COMMIT_HASH STREQUAL GIT_TAG_HASH)
94-
set(AVRDUDE_FULL_VERSION "${CMAKE_PROJECT_VERSION}-${GIT_COMMIT_DATE} (${GIT_COMMIT_HASH})")
94+
set(AVRDUDE_FULL_VERSION "${CMAKE_PROJECT_VERSION}-${GIT_COMMIT_DATE}${EXTRA_VERSION} (${GIT_COMMIT_HASH})")
9595
endif()
9696
endif()
9797

@@ -374,6 +374,7 @@ if (DEBUG_CMAKE)
374374
message(STATUS "CMAKE_C_COMPILER: ${CMAKE_C_COMPILER}")
375375
message(STATUS "CONFIG_DIR: ${CONFIG_DIR}")
376376
message(STATUS "AVRDUDE_FULL_VERSION: ${AVRDUDE_FULL_VERSION}")
377+
message(STATUS "EXTRA_VERSION: ${EXTRA_VERSION}")
377378
message(STATUS "USE_EXTERNAL_LIBS: ${USE_EXTERNAL_LIBS}")
378379
message(STATUS "USE_LIBUSBWIN32: ${USE_LIBUSBWIN32}")
379380
message(STATUS "HAVE_LIBELF: ${HAVE_LIBELF}")

src/configure.ac

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -80,11 +80,12 @@ AC_MSG_RESULT([$PACKAGE_VERSION])
8080
dnl Compose the full version message mirroring the cmake one, inform
8181
dnl about it and pass it on to avrdude.conf and the "avrdude -?"
8282
dnl version message
83+
AC_ARG_VAR([EXTRA_VERSION], [extra version information to be added to version info])
8384
AC_MSG_CHECKING([versioninfo derived AVRDUDE_FULL_VERSION])
8485
if test "x$GIT_COMMIT_HASH" = "x$GIT_TAG_HASH"; then
85-
AVRDUDE_FULL_VERSION="$PACKAGE_VERSION"
86+
AVRDUDE_FULL_VERSION="$PACKAGE_VERSION$EXTRA_VERSION"
8687
else
87-
AVRDUDE_FULL_VERSION="$PACKAGE_VERSION ($GIT_COMMIT_HASH)"
88+
AVRDUDE_FULL_VERSION="$PACKAGE_VERSION$EXTRA_VERSION ($GIT_COMMIT_HASH)"
8889
fi
8990
AC_MSG_RESULT([$AVRDUDE_FULL_VERSION])
9091
AC_DEFINE_UNQUOTED([AVRDUDE_FULL_VERSION], ["$AVRDUDE_FULL_VERSION"],

0 commit comments

Comments
 (0)