aboutsummaryrefslogtreecommitdiffstats
path: root/CMakeLists.txt
diff options
context:
space:
mode:
authorPeter Wu <peter@lekensteyn.nl>2019-07-27 17:10:39 +0100
committerPeter Wu <peter@lekensteyn.nl>2019-08-12 20:26:32 +0000
commit86a35ac6a20098c248b7a69944146bad368e6228 (patch)
treebaab0b53eff6ab9e34ddc769a29539fbe9a17ed4 /CMakeLists.txt
parentb22030f7124bb48e80acc1ab93a1d9449c50a2df (diff)
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>
Diffstat (limited to 'CMakeLists.txt')
-rw-r--r--CMakeLists.txt26
1 files changed, 18 insertions, 8 deletions
diff --git a/CMakeLists.txt b/CMakeLists.txt
index 07d40e4ba6..4a4bd4b1be 100644
--- a/CMakeLists.txt
+++ b/CMakeLists.txt
@@ -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