summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorRomain Forlot <romain.forlot@iot.bzh>2018-11-08 15:07:37 +0100
committerRomain Forlot <romain.forlot@iot.bzh>2018-11-08 15:08:07 +0100
commit53db393494cf1478a61f3ff70b9da34b60a562e6 (patch)
treed044cab3c7b30f85997c99de30b19d8171b67ac1
parent5bc5dc92b25e78c6b27ff508899eec86528a8d17 (diff)
Packaging: find version from command line argument
There is a lack in the way to find the project version when you package a project using cmake-apps-module because there isn't git repo included in the source archive then the git tag could not be retrieved. So this commit brings the possibility to set the version from the command line using the argument VERSION. Change-Id: Iba9902a2a1c61a348d719aaca85c26b3786d3620 Signed-off-by: Romain Forlot <romain.forlot@iot.bzh>
-rw-r--r--src/cmake/cmake.d/02-variables.cmake6
1 files changed, 4 insertions, 2 deletions
diff --git a/src/cmake/cmake.d/02-variables.cmake b/src/cmake/cmake.d/02-variables.cmake
index 4ced24e..e682078 100644
--- a/src/cmake/cmake.d/02-variables.cmake
+++ b/src/cmake/cmake.d/02-variables.cmake
@@ -81,10 +81,12 @@ execute_process(COMMAND git status --short
# Include project configuration
# ------------------------------
-if(NOT PROJECT_VERSION AND NOT GIT_PROJECT_VERSION)
- message(FATAL_ERROR "${Red}No version tag found from your project's source directory and no PROJECT_VERSION set in your config.cmake file. Please set a version tag or cmake variable in your config.cmake. Abort!")
+if(NOT PROJECT_VERSION AND NOT GIT_PROJECT_VERSION AND NOT VERSION)
+ message(FATAL_ERROR "${Red}No version found. Please set a version tag or PROJECT_VERSION cmake variable in your config.cmake. Abort!")
elseif(NOT PROJECT_VERSION AND GIT_PROJECT_VERSION)
set(PROJECT_VERSION ${GIT_PROJECT_VERSION})
+elseif(NOT PROJECT_VERSION AND VERSION)
+ set(PROJECT_VERSION ${VERSION})
endif()
# Release additionnals informations isn't supported so setting project