2022-02-04 17:27:13 +08:00
|
|
|
# SPDX-License-Identifier: Apache-2.0
|
|
|
|
|
|
|
|
cmake_minimum_required(VERSION 3.20.0)
|
|
|
|
|
2024-09-06 20:05:08 +08:00
|
|
|
set(ZEPHYR_BASE $ENV{ZEPHYR_BASE} CACHE PATH "Zephyr base")
|
|
|
|
set(CMAKE_MODULE_PATH ${CMAKE_MODULE_PATH} ${ZEPHYR_BASE}/cmake/modules)
|
|
|
|
|
|
|
|
include(git)
|
|
|
|
|
2023-03-23 15:43:01 +08:00
|
|
|
if(VERSION_TYPE STREQUAL KERNEL)
|
|
|
|
set(BUILD_VERSION_NAME BUILD_VERSION)
|
|
|
|
else()
|
|
|
|
set(BUILD_VERSION_NAME ${VERSION_TYPE}_BUILD_VERSION)
|
|
|
|
endif()
|
|
|
|
|
|
|
|
if(NOT DEFINED ${BUILD_VERSION_NAME})
|
|
|
|
cmake_path(GET VERSION_FILE PARENT_PATH work_dir)
|
2024-09-06 20:05:08 +08:00
|
|
|
git_describe(${work_dir} ${BUILD_VERSION_NAME})
|
2022-02-04 17:27:13 +08:00
|
|
|
endif()
|
|
|
|
|
2021-12-17 00:13:54 +08:00
|
|
|
include(${ZEPHYR_BASE}/cmake/modules/version.cmake)
|
2023-03-23 15:43:01 +08:00
|
|
|
file(READ ${ZEPHYR_BASE}/version.h.in version_content)
|
|
|
|
string(CONFIGURE "${version_content}" version_content)
|
|
|
|
string(CONFIGURE "${version_content}" version_content)
|
|
|
|
file(WRITE ${OUT_FILE} "${version_content}")
|