cmake: allow VCSVERSION to be overridden with VCSVERSION_OVERRIDE
The default VCSVERSION from make-version.pl is based on the "git archive" information (for tarballs) or uses "git describe" to discover the version. Distributors such as Debian who directly build from a Git repository might want to include a deterministic value, therefore add a new option to achieve this. Change-Id: I5a39670519f4d846020d917b124fc4d548d00137 Reviewed-on: https://code.wireshark.org/review/34100 Petri-Dish: Peter Wu <peter@lekensteyn.nl> Tested-by: Petri Dish Buildbot Reviewed-by: Peter Wu <peter@lekensteyn.nl>
This commit is contained in:
parent
b22030f712
commit
86a35ac6a2
|
@ -1505,13 +1505,21 @@ include(gmxTestLargeFiles)
|
|||
gmx_test_large_files(GMX_LARGEFILES)
|
||||
|
||||
set( VERSION ${PROJECT_VERSION} )
|
||||
add_custom_target(version
|
||||
BYPRODUCTS version.h
|
||||
COMMAND ${PERL_EXECUTABLE}
|
||||
${CMAKE_SOURCE_DIR}/tools/make-version.pl
|
||||
${CMAKE_SOURCE_DIR}
|
||||
)
|
||||
set_target_properties(version PROPERTIES FOLDER "Auxiliary")
|
||||
if(VCSVERSION_OVERRIDE)
|
||||
# Allow distributors to override detection of the Git tag and version.
|
||||
string(CONFIGURE "#define VCSVERSION \"@VCSVERSION_OVERRIDE@\"\n"
|
||||
_version_h_contents ESCAPE_QUOTES)
|
||||
file(WRITE "${CMAKE_BINARY_DIR}/version.h" "${_version_h_contents}")
|
||||
message(STATUS "VCSVERSION_OVERRIDE: ${VCSVERSION_OVERRIDE}")
|
||||
else()
|
||||
add_custom_target(version
|
||||
BYPRODUCTS version.h
|
||||
COMMAND ${PERL_EXECUTABLE}
|
||||
${CMAKE_SOURCE_DIR}/tools/make-version.pl
|
||||
${CMAKE_SOURCE_DIR}
|
||||
)
|
||||
set_target_properties(version PROPERTIES FOLDER "Auxiliary")
|
||||
endif()
|
||||
|
||||
set( configure_input "Built with CMake ${CMAKE_VERSION}" )
|
||||
configure_file(${CMAKE_SOURCE_DIR}/cmakeconfig.h.in ${CMAKE_BINARY_DIR}/config.h)
|
||||
|
@ -2119,7 +2127,9 @@ set_target_properties(copy_data_files PROPERTIES FOLDER "Copy Tasks")
|
|||
# Shared code, build object files once for all users.
|
||||
add_library(version_info OBJECT version_info.c)
|
||||
target_include_directories(version_info SYSTEM PRIVATE ${VERSION_INFO_INCLUDE_DIRS})
|
||||
add_dependencies(version_info version)
|
||||
if(NOT VCSVERSION_OVERRIDE)
|
||||
add_dependencies(version_info version)
|
||||
endif()
|
||||
# sources common for wireshark, tshark, rawshark and sharkd
|
||||
add_library(shark_common OBJECT
|
||||
cfile.c
|
||||
|
|
|
@ -14,6 +14,12 @@
|
|||
# CMakeLists.txt will have the version_extra template appended to the
|
||||
# version number. version.h will _not_ be generated if either argument is
|
||||
# present.
|
||||
#
|
||||
# make-version.pl is called during the build to update version.h in the build
|
||||
# directory. To set a fixed version, use something like:
|
||||
#
|
||||
# cmake -DVCSVERSION_OVERRIDE="Git v3.1.0 packaged as 3.1.0-1"
|
||||
#
|
||||
|
||||
# XXX - We're pretty dumb about the "{vcsinfo}" substitution, and about having
|
||||
# spaces in the package format.
|
||||
|
|
Loading…
Reference in New Issue