cpack
authorMichael Wallner <mike@php.net>
Fri, 11 Dec 2020 18:58:30 +0000 (19:58 +0100)
committerMichael Wallner <mike@php.net>
Fri, 11 Dec 2020 18:58:35 +0000 (19:58 +0100)
CMakeLists.txt
CPack.txt [new file with mode: 0644]

index ef29a4116b7d955f385ad9ac1ab24250430bbac2..d8217f0805c17e1e8447e691f99c0f1d018b2a11 100644 (file)
@@ -8,7 +8,8 @@ include(CMakeVersions.txt)
 
 project(libmemcached
         VERSION "${LIBMEMCACHED_VERSION}"
-        DESCRIPTION "libmemcached https://github.com/m6w6/libmemcached"
+        HOMEPAGE_URL "https://github.com/m6w6/libmemcached"
+        DESCRIPTION "libmemcached, a C/C++ memcached client library"
         )
 
 set(CXX_STANDARD 11)
@@ -16,6 +17,10 @@ set(CMAKE_POSITION_INDEPENDENT_CODE ON)
 
 include(CMakeConfig.txt)
 
+if(BUILD_DOCS OR BUILD_DOCSONLY)
+    add_subdirectory(docs)
+endif()
+
 if(NOT BUILD_DOCSONLY)
 
     set(CLIENTS
@@ -44,10 +49,7 @@ if(NOT BUILD_DOCSONLY)
 
     # keep last
     configure_file(${CONFIGURE_FILE_IN} ${CONFIGURE_FILE_OUT} @ONLY)
-endif()
-
-if(BUILD_DOCS OR BUILD_DOCSONLY)
-    add_subdirectory(docs)
+    include(CPack.txt)
 endif()
 
 if(ENV{INVALID_CONFIGURATION})
diff --git a/CPack.txt b/CPack.txt
new file mode 100644 (file)
index 0000000..fae9db3
--- /dev/null
+++ b/CPack.txt
@@ -0,0 +1,47 @@
+# options
+
+# DEBs
+if(EXISTS /usr/bin/dpkg)
+    message(STATUS "Enabling Debian packages")
+    set(CPACK_BINARY_DEB ON)
+endif()
+
+# BSDs
+if(CMAKE_SYSTEM_NAME MATCHES BSD AND EXISTS CPackFreeBSD.txt)
+    message(STATUS "Enabling FreeBSD packages")
+    set(CPACK_BINARY_FREEBSD ON)
+    include(CPackFreeBSD.txt)
+endif()
+
+# RPMs
+if(EXISTS /usr/bin/dnf OR EXISTS /usr/bin/yum OR EXISTS /usr/bin/rpm-build)
+    message(STATUS "Enabling RPM packages")
+    set(CPACK_BINARY_RPM ON)
+endif()
+
+# shell installer
+set(CPACK_BINARY_STGZ ON)
+
+# binary archive
+set(CPACK_BINARY_TBZ2 0)
+set(CPACK_BINARY_TGZ ${UNIX})
+set(CPACK_BINARY_TXZ 0)
+set(CPACK_BINARY_TZ 0)
+set(CPACK_BINARY_ZIP ${WIN32})
+
+# source archive
+set(CPACK_SOURCE_TBZ2 0)
+set(CPACK_SOURCE_TGZ ${UNIX})
+set(CPACK_SOURCE_TXZ 0)
+set(CPACK_SOURCE_TZ 0)
+set(CPACK_SOURCE_ZIP ${WIN32})
+
+# project internals
+set(CPACK_PACKAGE_VENDOR ${CMAKE_PROJECT_HOMEPAGE_URL})
+set(CPACK_PACKAGE_DESCRIPTION_FILE "${CMAKE_SOURCE_DIR}/README.md")
+set(CPACK_PACKAGE_INSTALL_DIRECTORY "${CPACK_PACKAGE_NAME}/${CPACK_PACKAGE_VERSION}")
+set(CPACK_PACKAGE_CHECKSUM SHA1)
+set(CPACK_RESOURCE_FILE_LICENSE "${CMAKE_SOURCE_DIR}/LICENSE")
+set(CPACK_RESOURCE_FILE_README "${CMAKE_SOURCE_DIR}/README.md")
+
+include(CPack)