diff --git a/CMakeLists.txt b/CMakeLists.txt index 4122249cc1a..d9f07cef23b 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -552,6 +552,21 @@ add_custom_command( ) add_custom_target(version_h DEPENDS ${PROJECT_BINARY_DIR}/include/generated/version.h) +if(EXISTS ${APPLICATION_SOURCE_DIR}/VERSION) + add_custom_command( + OUTPUT ${PROJECT_BINARY_DIR}/include/generated/app_version.h + COMMAND ${CMAKE_COMMAND} -DZEPHYR_BASE=${ZEPHYR_BASE} + -DOUT_FILE=${PROJECT_BINARY_DIR}/include/generated/app_version.h + -DVERSION_TYPE=APP + -DVERSION_FILE=${APPLICATION_SOURCE_DIR}/VERSION + ${build_version_argument} + -P ${ZEPHYR_BASE}/cmake/gen_version_h.cmake + DEPENDS ${APPLICATION_SOURCE_DIR}/VERSION ${git_dependency} + ) + add_custom_target(app_version_h DEPENDS ${PROJECT_BINARY_DIR}/include/generated/app_version.h) + add_dependencies(zephyr_interface app_version_h) +endif() + # Unfortunately, the order in which CMakeLists.txt code is processed # matters so we need to be careful about how we order the processing # of subdirectories. One example is "Compiler flags added late in the