diff options
author | Friedemann Kleint <Friedemann.Kleint@qt.io> | 2017-08-22 10:58:19 +0200 |
---|---|---|
committer | Friedemann Kleint <Friedemann.Kleint@qt.io> | 2017-08-22 11:10:23 +0200 |
commit | 52c58bfc2247449c81b06e4122022355d4d1dcde (patch) | |
tree | 46a36e351b08e4307ff1ec3308869373cc0d9e5b /sources/pyside2/CMakeLists.txt | |
parent | 58a93d240c5bdd3bc60ccddbc31676bd0fa2eae3 (diff) | |
parent | 8aca0dec116c6b321373f5636b34036530ac6e4b (diff) |
Merge remote-tracking branch 'origin/5.6' into 5.9
Change-Id: Iddee2cf511ee0f0896a04a76e5b5b8bd44d1d6f1
Diffstat (limited to 'sources/pyside2/CMakeLists.txt')
-rw-r--r-- | sources/pyside2/CMakeLists.txt | 46 |
1 files changed, 46 insertions, 0 deletions
diff --git a/sources/pyside2/CMakeLists.txt b/sources/pyside2/CMakeLists.txt index d5a12379b..d517d0ad7 100644 --- a/sources/pyside2/CMakeLists.txt +++ b/sources/pyside2/CMakeLists.txt @@ -171,6 +171,52 @@ else() CACHE STRING "PySide version [full]" FORCE) endif() +string(TIMESTAMP PYSIDE_BUILD_DATE "%Y-%m-%dT%H:%M:%S+00:00" UTC) +if (PYSIDE_BUILD_DATE) + set(PYSIDE_BUILD_DATE "__build_date__ = '${PYSIDE_BUILD_DATE}'") +endif() + +find_package(Git) +if(GIT_FOUND) + # Check if current source folder is inside a git repo, so that commit information can be + # queried. + execute_process( + COMMAND ${GIT_EXECUTABLE} rev-parse --git-dir + OUTPUT_VARIABLE PYSIDE_SOURCE_IS_INSIDE_REPO + ERROR_QUIET + OUTPUT_STRIP_TRAILING_WHITESPACE) + + if(PYSIDE_SOURCE_IS_INSIDE_REPO) + # Force git dates to be UTC-based. + set(ENV{TZ} UTC) + execute_process( + COMMAND ${GIT_EXECUTABLE} --no-pager show --date=format-local:%Y-%m-%dT%H:%M:%S+00:00 -s --format=%cd HEAD + OUTPUT_VARIABLE PYSIDE_BUILD_COMMIT_DATE + OUTPUT_STRIP_TRAILING_WHITESPACE) + if(PYSIDE_BUILD_COMMIT_DATE) + set(PYSIDE_BUILD_COMMIT_DATE "__build_commit_date__ = '${PYSIDE_BUILD_COMMIT_DATE}'") + endif() + unset(ENV{TZ}) + + execute_process( + COMMAND ${GIT_EXECUTABLE} rev-parse HEAD + OUTPUT_VARIABLE PYSIDE_BUILD_COMMIT_HASH + OUTPUT_STRIP_TRAILING_WHITESPACE) + if(PYSIDE_BUILD_COMMIT_HASH) + set(PYSIDE_BUILD_COMMIT_HASH "__build_commit_hash__ = '${PYSIDE_BUILD_COMMIT_HASH}'") + endif() + + execute_process( + COMMAND ${GIT_EXECUTABLE} describe HEAD + OUTPUT_VARIABLE PYSIDE_BUILD_COMMIT_HASH_DESCRIBED + OUTPUT_STRIP_TRAILING_WHITESPACE) + if(PYSIDE_BUILD_COMMIT_HASH_DESCRIBED) + set(PYSIDE_BUILD_COMMIT_HASH_DESCRIBED "__build_commit_hash_described__ = '${PYSIDE_BUILD_COMMIT_HASH_DESCRIBED}'") + endif() + + endif() +endif() + include(PySideModules) macro(COLLECT_MODULE_IF_FOUND shortname) |