summaryrefslogtreecommitdiffhomepage
path: root/cmake
diff options
context:
space:
mode:
authorAki <please@ignore.pl>2024-02-18 01:58:05 +0100
committerAki <please@ignore.pl>2024-02-18 02:06:42 +0100
commit67068c9cd91e11800d9a06b386705100a2050da0 (patch)
tree75ff7f7c20430785c012668524173929fe5a69a4 /cmake
parent7f5562530f9a1decfae9e4c88b95422c82ed829c (diff)
downloadstarshatter-67068c9cd91e11800d9a06b386705100a2050da0.zip
starshatter-67068c9cd91e11800d9a06b386705100a2050da0.tar.gz
starshatter-67068c9cd91e11800d9a06b386705100a2050da0.tar.bz2
All files containing version are now updated more consistently
Diffstat (limited to 'cmake')
-rw-r--r--cmake/modules/AddVersionFile.cmake13
-rw-r--r--cmake/modules/download_resource.cmake.in1
-rw-r--r--cmake/modules/generate_version_file.cmake3
3 files changed, 16 insertions, 1 deletions
diff --git a/cmake/modules/AddVersionFile.cmake b/cmake/modules/AddVersionFile.cmake
index 67b3371..a0208c8 100644
--- a/cmake/modules/AddVersionFile.cmake
+++ b/cmake/modules/AddVersionFile.cmake
@@ -1,8 +1,19 @@
+# Adds a target that generates file with version information:
+#
+# add_version_file(version.txt version.txt.conf ALL)
+#
+# Where 'version.txt.conf' is a template file which has referenced like "@VARIABLE@" substituted with appropriate
+# values.
+
set(ADD_VERSION_FILE_DIR "${CMAKE_CURRENT_LIST_DIR}")
function(add_version_file OUTPUT TEMPLATE)
+ cmake_parse_arguments(PARSE_ARGV 2 VERSION_FILE "ALL" "" "")
+ if(VERSION_FILE_ALL)
+ set(VERSION_FILE_ALL_ARG ALL)
+ endif()
add_custom_target(
${OUTPUT}
- ALL
+ ${VERSION_FILE_ALL_ARG}
BYPRODUCTS "${CMAKE_CURRENT_BINARY_DIR}/${OUTPUT}"
DEPENDS "${CMAKE_CURRENT_SOURCE_DIR}/${TEMPLATE}"
WORKING_DIRECTORY "${CMAKE_CURRENT_SOURCE_DIR}"
diff --git a/cmake/modules/download_resource.cmake.in b/cmake/modules/download_resource.cmake.in
index 26a1347..e41ff31 100644
--- a/cmake/modules/download_resource.cmake.in
+++ b/cmake/modules/download_resource.cmake.in
@@ -1,3 +1,4 @@
+# See AddDownloadableResource.cmake
file(
DOWNLOAD @RESOURCE_BASE_URL@/@RESOURCE_ARCHIVE_BASENAME@ @RESOURCE_ARCHIVE@
EXPECTED_HASH SHA1=@RESOURCE_SHA1@
diff --git a/cmake/modules/generate_version_file.cmake b/cmake/modules/generate_version_file.cmake
index e8d8196..874d0ab 100644
--- a/cmake/modules/generate_version_file.cmake
+++ b/cmake/modules/generate_version_file.cmake
@@ -1,3 +1,6 @@
+# See AddVersionFile.cmake
include(GitDescribe)
+include(GitToResource)
git_describe(STARSHATTER_VERSION)
+git_to_resource(STARSHATTER_VERSION_RC ${STARSHATTER_VERSION})
configure_file("${TEMPLATE}" "${OUTPUT}" @ONLY)