diff options
author | Dario Lombardo <lomato@gmail.com> | 2018-04-15 22:53:11 +0200 |
---|---|---|
committer | Anders Broman <a.broman58@gmail.com> | 2018-04-16 08:53:30 +0000 |
commit | 71ddbb69f53be653b59fb2f81adb3a5ea076f1fc (patch) | |
tree | a53efcef12102840759bda466ab1e2c9ca4f2ac2 /CMakeLists.txt | |
parent | 9f851c284f86306f8a795646443e8fe070c8a827 (diff) |
RPM: support building from out-of-tree directories.
When building the RPM from a directory at the same level as the
source (like in mdkir build;cmake ../wireshark;make rpm-package)
we can't rely on the retrieval of the git version. However the
wireshark export dir still have it and we can get it from there.
Change-Id: Id6bcb453ec3a65977fc092c610e99e8dd01f613a
Reviewed-on: https://code.wireshark.org/review/26957
Reviewed-by: Anders Broman <a.broman58@gmail.com>
Diffstat (limited to 'CMakeLists.txt')
-rw-r--r-- | CMakeLists.txt | 5 |
1 files changed, 5 insertions, 0 deletions
diff --git a/CMakeLists.txt b/CMakeLists.txt index 75e01e6fb1..60466419b2 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -2930,6 +2930,11 @@ if(RPMBUILD_EXECUTABLE AND GIT_EXECUTABLE) OUTPUT_STRIP_TRAILING_WHITESPACE WORKING_DIRECTORY ${CMAKE_SOURCE_DIR} ) + if (NOT _git_description) + # We're building the rpm outside the source. Guess the version from the dirname. + get_filename_component(CMAKE_SOURCE_DIR_NAME ${CMAKE_SOURCE_DIR} NAME) + string(SUBSTRING "${CMAKE_SOURCE_DIR_NAME}" 10 -1 _git_description) + endif() string(SUBSTRING "${_git_description}" 1 -1 RPM_TARBALL_VERSION) string(REPLACE "-" "_" RPM_VERSION "${RPM_TARBALL_VERSION}") configure_file(packaging/rpm/wireshark.spec.in ${CMAKE_BINARY_DIR}/packaging/rpm/SPECS/wireshark.spec) |