summaryrefslogtreecommitdiffstats
path: root/cmake/version.cmake
diff options
context:
space:
mode:
authorManuel Bentele2020-10-23 18:13:15 +0200
committerManuel Bentele2020-10-23 18:13:15 +0200
commit588368dd2a46ddec70741c6cc87a79a0b26ee383 (patch)
tree69265caba9b1fb0ee126c142538b75fd49bbe8ee /cmake/version.cmake
parentMove the source code of all xloop components to the common 'src' directory (diff)
downloadxloop-588368dd2a46ddec70741c6cc87a79a0b26ee383.tar.gz
xloop-588368dd2a46ddec70741c6cc87a79a0b26ee383.tar.xz
xloop-588368dd2a46ddec70741c6cc87a79a0b26ee383.zip
Add automatic generation of version and build type headers for compilation
This change replaces the static version and build type header file generation by CMake with dynamic CMake targets to generate the version file whenever a Make target is executed. Thus, there is no need anymore to reconfigure and rerun CMake after the repository version or build configuration has changed.
Diffstat (limited to 'cmake/version.cmake')
-rw-r--r--cmake/version.cmake21
1 files changed, 0 insertions, 21 deletions
diff --git a/cmake/version.cmake b/cmake/version.cmake
deleted file mode 100644
index 07483af..0000000
--- a/cmake/version.cmake
+++ /dev/null
@@ -1,21 +0,0 @@
-# SPDX-License-Identifier: GPL-2.0
-#
-# CMake macros to get version numbers
-# Copyright (C) 2020 Manuel Bentele <development@manuel-bentele.de>
-#
-
-# macro to get Linux kernel version from KERNEL_BUILD_DIR
-macro(get_kernel_version LINUX_KERNEL_VERSION KERNEL_BUILD_DIR)
- string(REGEX MATCH "[0-9]+\\.[0-9]+\\.[0-9]+" LINUX_KERNEL_VERSION ${KERNEL_BUILD_DIR})
- if(LINUX_KERNEL_VERSION STREQUAL "")
- set(LINUX_KERNEL_VERSION "unknown")
- endif()
-endmacro(get_kernel_version)
-
-# macro to get short hash of latest commit
-macro(get_repository_version REPOSITORY_VERSION)
- execute_process(COMMAND git rev-parse --short HEAD
- OUTPUT_VARIABLE SHORT_HASH_RESULT
- OUTPUT_STRIP_TRAILING_WHITESPACE)
- string(REGEX MATCH "[0-9a-fA-F]+" REPOSITORY_VERSION ${SHORT_HASH_RESULT})
-endmacro(get_repository_version)