summaryrefslogtreecommitdiffstats
path: root/vtag.cmake
diff options
context:
space:
mode:
authorJon Bratseth <bratseth@yahoo-inc.com>2016-06-15 23:09:44 +0200
committerJon Bratseth <bratseth@yahoo-inc.com>2016-06-15 23:09:44 +0200
commit72231250ed81e10d66bfe70701e64fa5fe50f712 (patch)
tree2728bba1131a6f6e5bdf95afec7d7ff9358dac50 /vtag.cmake
Publish
Diffstat (limited to 'vtag.cmake')
-rw-r--r--vtag.cmake24
1 files changed, 24 insertions, 0 deletions
diff --git a/vtag.cmake b/vtag.cmake
new file mode 100644
index 00000000000..5c86b7a7bb6
--- /dev/null
+++ b/vtag.cmake
@@ -0,0 +1,24 @@
+# Copyright 2016 Yahoo Inc. Licensed under the terms of the Apache 2.0 license. See LICENSE in the project root.
+if(NOT EXISTS "${CMAKE_SOURCE_DIR}/dist/vtag.map")
+ message(FATAL_ERROR "dist/vtag.map does not exist, please run bootstrap.sh before configuring cmake" )
+endif()
+
+function(get_vtag_define KEY)
+ file(STRINGS dist/vtag.map VALUE REGEX "${KEY}")
+ list(GET VALUE 0 LINE)
+ separate_arguments(DATA UNIX_COMMAND "${LINE}")
+ list(GET DATA 1 VALUE)
+ set(DEFINE "-D${KEY}=\\\"${VALUE}\\\"")
+ set(${KEY} "${DEFINE}" PARENT_SCOPE)
+endfunction()
+
+get_vtag_define(V_TAG)
+get_vtag_define(V_TAG_DATE)
+get_vtag_define(V_TAG_PKG)
+get_vtag_define(V_TAG_ARCH)
+get_vtag_define(V_TAG_SYSTEM)
+get_vtag_define(V_TAG_SYSTEM_REV)
+get_vtag_define(V_TAG_BUILDER)
+get_vtag_define(V_TAG_COMPONENT)
+
+set(VTAG_DEFINES "${V_TAG} ${V_TAG_DATE} ${V_TAG_PKG} ${V_TAG_ARCH} ${V_TAG_SYSTEM} ${V_TAG_SYSTEM_REV} ${V_TAG_BUILDER} ${V_TAG_COMPONENT}")