cmake: change artifacts directory structure
authorMichael Wallner <mike@php.net>
Wed, 28 Jul 2021 08:46:41 +0000 (10:46 +0200)
committerMichael Wallner <mike@php.net>
Fri, 30 Jul 2021 05:30:21 +0000 (07:30 +0200)
CPack.txt
CPack/ProjectConfig.txt

index eca05503ce65febea4eb8f75d99c0db909046c3c..1a4d77dc9433f6ac4a3b5071ade4d5f18c8340ab 100644 (file)
--- a/CPack.txt
+++ b/CPack.txt
@@ -38,11 +38,7 @@ set(CPACK_PACKAGE_DESCRIPTION
 for the memcached server (http://memcached.org/). It has been designed
 to be light on memory usage, thread safe, and provide full access to
 server side methods.")
-if(CMAKE_VERSION VERSION_LESS 3.12)
-    string(REPLACE ";" "-" CPACK_PACKAGE_DIRECTORY "${CMAKE_BINARY_DIR}/${PROJECT_CONFIG}")
-else()
-    list(JOIN PROJECT_CONFIG "-" CPACK_PACKAGE_DIRECTORY)
-endif()
+set(CPACK_PROJECT_CONFIG ${PROJECT_CONFIG})
 set(CPACK_PROJECT_CONFIG_FILE "${CMAKE_SOURCE_DIR}/CPack/ProjectConfig.txt")
 set(CPACK_PACKAGE_DESCRIPTION_FILE "${CMAKE_SOURCE_DIR}/README.md")
 set(CPACK_PACKAGE_INSTALL_DIRECTORY "${PROJECT_NAME}/${PROJECT_VERSION}")
@@ -50,6 +46,7 @@ set(CPACK_PACKAGE_CHECKSUM SHA1)
 set(CPACK_RESOURCE_FILE_LICENSE "${CMAKE_SOURCE_DIR}/LICENSE")
 set(CPACK_RESOURCE_FILE_README "${CMAKE_SOURCE_DIR}/README.md")
 set(CPACK_CHANGELOG_FILE "${CMAKE_SOURCE_DIR}/ChangeLog-1.1.md")
+set(CPACK_PACKAGE_DIRECTORY "${CMAKE_BINARY_DIR}")
 
 execute_process(
         COMMAND git describe --tags --match [0-9]*.*
@@ -63,8 +60,10 @@ endif()
 string(STRIP "${PROJECT_TAG}" PROJECT_TAG)
 if(PROJECT_TAG)
     set(CPACK_PACKAGE_FILE_NAME ${PROJECT_NAME}-${PROJECT_TAG})
+    set(CPACK_PACKAGE_VERSION ${PROJECT_TAG})
 else()
     set(CPACK_PACKAGE_FILE_NAME ${PROJECT_NAME}-${PROJECT_VERSION})
+    set(CPACK_PACKAGE_VERSION ${PROJECT_VERSION})
 endif()
 
 # dependencies
@@ -100,13 +99,13 @@ include(CPack)
 
 set(PUSH_ARTIFACTS_SH "${CMAKE_SOURCE_DIR}/scripts/push-artifacts.sh")
 if(WIN32)
-    set(PUSH_ARTIFACTS_CMD msys2 -c '${PUSH_ARTIFACTS_SH} ${CPACK_PACKAGE_DIRECTORY}/')
+    set(PUSH_ARTIFACTS_CMD msys2 -c '${PUSH_ARTIFACTS_SH} ${CPACK_PACKAGE_VERSION}')
 else()
-    set(PUSH_ARTIFACTS_CMD ${PUSH_ARTIFACTS_SH} ${CPACK_PACKAGE_DIRECTORY}/)
+    set(PUSH_ARTIFACTS_CMD ${PUSH_ARTIFACTS_SH} ${CPACK_PACKAGE_VERSION})
 endif()
 
 add_custom_target(push-artifacts
         COMMAND ${PUSH_ARTIFACTS_CMD}
-        WORKING_DIRECTORY ${CPACK_BINARY_DIR}
+        WORKING_DIRECTORY ${CPACK_PACKAGE_DIRECTORY}
         )
 
index 2b80cac1c8587f1473d26d6d53200c4c77c9b7cb..4e4e3e199fc969a492c223c986d18b6833248fc1 100644 (file)
@@ -1 +1 @@
-string(APPEND CPACK_PACKAGE_DIRECTORY "/${CPACK_GENERATOR}")
+string(REPLACE ";" "-" CPACK_PACKAGE_DIRECTORY "${CPACK_PACKAGE_DIRECTORY}/${CPACK_PACKAGE_VERSION}/${CPACK_GENERATOR}/${CPACK_PROJECT_CONFIG}")