diff options
| author | Eduard Braun <eduard.braun2@gmx.de> | 2017-07-16 15:10:28 +0000 |
|---|---|---|
| committer | Eduard Braun <eduard.braun2@gmx.de> | 2017-07-16 15:33:43 +0000 |
| commit | 4a543072019e0bd4a0fcaaa3c2cef718e045edc6 (patch) | |
| tree | 559fd60d6e356d0dcda2a548e00cee4904f63ed0 | |
| parent | root dir tidying: cleanup inkscape icons (diff) | |
| download | inkscape-4a543072019e0bd4a0fcaaa3c2cef718e045edc6.tar.gz inkscape-4a543072019e0bd4a0fcaaa3c2cef718e045edc6.zip | |
cmake: fix 'dist' target to actually include INKSCAPE_REVISION
(re-use inkscape-version.cpp in order not to duplicate code)
| -rw-r--r-- | CMakeLists.txt | 22 | ||||
| -rw-r--r-- | CMakeScripts/inkscape-version.cmake | 16 |
2 files changed, 16 insertions, 22 deletions
diff --git a/CMakeLists.txt b/CMakeLists.txt index e3bd4edb1..248de1737 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -151,22 +151,16 @@ endif() # ----------------------------------------------------------------------------- # Dist Target # ----------------------------------------------------------------------------- -if(EXISTS ${CMAKE_SOURCE_DIR}/.git/) - execute_process( - COMMAND git log -n 1 --pretty=%cd --date=short - WORKING_DIRECTORY ${CMAKE_SOURCE_DIR} - OUTPUT_VARIABLE INKSCAPE_REVISION - OUTPUT_STRIP_TRAILING_WHITESPACE) -else() - set(INKSCAPE_REVISION "unknown") -endif() +set(INKSCAPE_SOURCE_DIR ${CMAKE_SOURCE_DIR}) +include(CMakeScripts/inkscape-version.cmake) + set(INKSCAPE_DIST_PREFIX "${PROJECT_NAME}-${INKSCAPE_VERSION}") add_custom_target(dist - COMMAND sed -i "s/unknown//" CMakeScripts/inkscape-version.cmake - && sed -i "s/custom//" CMakeScripts/inkscape-version.cmake - && tar cfz ${CMAKE_BINARY_DIR}/${INKSCAPE_DIST_PREFIX}.tar.gz ${CMAKE_SOURCE_DIR} --exclude=".*" --exclude-vcs-ignores - && git checkout ${CMAKE_SOURCE_DIR}/CMakeScripts/inkscape-version.cmake - WORKING_DIRECTORY "${CMAKE_SOURCE_DIR}") + COMMAND sed -i "s/unknown/${INKSCAPE_REVISION}/" CMakeScripts/inkscape-version.cmake + && tar cfz ${CMAKE_BINARY_DIR}/${INKSCAPE_DIST_PREFIX}.tar.gz ${CMAKE_SOURCE_DIR}/doc --exclude=".*" --exclude-vcs-ignores + || git checkout ${CMAKE_SOURCE_DIR}/CMakeScripts/inkscape-version.cmake + COMMAND git checkout ${CMAKE_SOURCE_DIR}/CMakeScripts/inkscape-version.cmake # duplicate to make sure we actually revert in case of error + WORKING_DIRECTORY "${CMAKE_SOURCE_DIR}" VERBATIM USES_TERMINAL) # ----------------------------------------------------------------------------- # Uninstall Target diff --git a/CMakeScripts/inkscape-version.cmake b/CMakeScripts/inkscape-version.cmake index fdfdf35c3..2fae589d1 100644 --- a/CMakeScripts/inkscape-version.cmake +++ b/CMakeScripts/inkscape-version.cmake @@ -1,18 +1,16 @@ # This is called by cmake as an extermal process from # ./src/CMakeLists.txt and creates inkscape-version.cpp # +# It's also included directly in ./CMakeLists.txt to +# determine INKSCAPE_REVISION for the 'dist' target +# # These variables are defined by the caller, matching the CMake equivilents. # - ${INKSCAPE_SOURCE_DIR} # - ${INKSCAPE_BINARY_DIR} -# We should extract the version from build.xml -# but for now just hard code - set(INKSCAPE_REVISION "unknown") -set(INKSCAPE_CUSTOM "custom") if(EXISTS ${INKSCAPE_SOURCE_DIR}/.git) - execute_process(COMMAND git rev-parse --short HEAD WORKING_DIRECTORY ${INKSCAPE_SOURCE_DIR} OUTPUT_VARIABLE INKSCAPE_REV_HASH @@ -29,9 +27,11 @@ if(EXISTS ${INKSCAPE_SOURCE_DIR}/.git) OUTPUT_VARIABLE INKSCAPE_SOURCE_MODIFIED OUTPUT_STRIP_TRAILING_WHITESPACE) if(NOT INKSCAPE_SOURCE_MODIFIED STREQUAL "") - set(INKSCAPE_REVISION "${INKSCAPE_REVISION}, ${INKSCAPE_CUSTOM}") + set(INKSCAPE_REVISION "${INKSCAPE_REVISION}, custom") endif() endif() -message("revision is " ${INKSCAPE_REVISION}) -configure_file(${INKSCAPE_SOURCE_DIR}/src/inkscape-version.cpp.in ${INKSCAPE_BINARY_DIR}/src/inkscape-version.cpp) +if(NOT "${INKSCAPE_BINARY_DIR}" STREQUAL "") + message("revision is " ${INKSCAPE_REVISION}) + configure_file(${INKSCAPE_SOURCE_DIR}/src/inkscape-version.cpp.in ${INKSCAPE_BINARY_DIR}/src/inkscape-version.cpp) +endif() |
