diff --git a/cmake/modules/version.cmake b/cmake/modules/version.cmake index 72c0424031..16d772e2cd 100644 --- a/cmake/modules/version.cmake +++ b/cmake/modules/version.cmake @@ -36,8 +36,12 @@ # The final load of `version.cmake` will setup correct build version values. if(NOT DEFINED VERSION_FILE AND NOT DEFINED VERSION_TYPE) - set(VERSION_FILE ${ZEPHYR_BASE}/VERSION ${APPLICATION_SOURCE_DIR}/VERSION) - set(VERSION_TYPE KERNEL APP) + set(VERSION_FILE ${ZEPHYR_BASE}/VERSION) + set(VERSION_TYPE KERNEL) + if(DEFINED APPLICATION_SOURCE_DIR) + list(APPEND VERSION_FILE ${APPLICATION_SOURCE_DIR}/VERSION) + list(APPEND VERSION_TYPE APP) + endif() endif() foreach(type file IN ZIP_LISTS VERSION_TYPE VERSION_FILE)