mirror of
https://github.com/ntop/n2n.git
synced 2024-09-19 16:41:11 +02:00
Add robustness to the version calculations
This commit is contained in:
parent
a38ec0f033
commit
108c9436d5
|
@ -8,10 +8,22 @@ set(CMAKE_EXPORT_COMPILE_COMMANDS ON)
|
|||
# N2n release information
|
||||
set(N2N_OSNAME ${CMAKE_SYSTEM_NAME})
|
||||
execute_process(
|
||||
COMMAND scripts/version.sh
|
||||
WORKING_DIRECTORY ${PROJECT_SOURCE_DIR}
|
||||
OUTPUT_VARIABLE PACKAGE_VERSION
|
||||
COMMAND scripts/version.sh
|
||||
WORKING_DIRECTORY ${PROJECT_SOURCE_DIR}
|
||||
OUTPUT_VARIABLE PACKAGE_VERSION
|
||||
RESULT_VARIABLE GIT_ERROR_CODE
|
||||
)
|
||||
if (NOT GIT_ERROR_CODE EQUAL 0)
|
||||
# - if we can run version.sh and it exits with an error that is signaling
|
||||
# a build failure.
|
||||
# - if we are on windows with no MSYS or Cygwin, we cannot run version.sh
|
||||
# which is the fallback case handled below
|
||||
# TODO: Distinguish between these two cases
|
||||
|
||||
# Fallback to just using the non dynamic short version string
|
||||
file(STRINGS VERSION PACKAGE_VERSION)
|
||||
endif (NOT GIT_ERROR_CODE EQUAL 0)
|
||||
|
||||
string(STRIP "${PACKAGE_VERSION}" PACKAGE_VERSION)
|
||||
MESSAGE(STATUS "Build for version: ${PACKAGE_VERSION}")
|
||||
|
||||
|
|
|
@ -148,7 +148,14 @@ COVERAGEDIR?=coverage
|
|||
.PHONY: steps build push all clean distclean install test cover gcov build-dep
|
||||
.PHONY: lint lint.python lint.ccode lint.shell lint.yaml
|
||||
|
||||
all: $(APPS) $(DOCS) $(SUBDIRS)
|
||||
all: version $(APPS) $(DOCS) $(SUBDIRS)
|
||||
|
||||
# This allows breaking the build if the version.sh script discovers
|
||||
# any inconsistancies
|
||||
.PHONY: version
|
||||
version:
|
||||
@echo -n "Build for version: "
|
||||
@scripts/version.sh
|
||||
|
||||
tools: $(N2N_LIB)
|
||||
$(MAKE) -C $@
|
||||
|
|
Loading…
Reference in New Issue
Block a user