-# options
+# default 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()
-
-if (EXISTS CPackNSIS.txt)
- include(CPackNSIS.txt)
+macro(cpack_include_if GENERATOR)
+ message(STATUS "Checking ${GENERATOR} package configuration ...")
+ if(EXISTS ${CMAKE_SOURCE_DIR}/CPack${GENERATOR}.txt)
+ message(STATUS " Sourcing ${CMAKE_SOURCE_DIR}/CPack${GENERATOR}.txt")
+ include(${CMAKE_SOURCE_DIR}/CPack${GENERATOR}.txt)
+ elseif(EXISTS ${CMAKE_BINARY_DIR}/CPack${GENERATOR}.txt)
+ message(STATUS " Sourcing ${CMAKE_BINARY_DIR}/CPack${GENERATOR}.txt")
+ include(${CMAKE_BINARY_DIR}/CPack${GENERATOR}.txt)
+ endif()
+endmacro()
# shell installer
set(CPACK_BINARY_STGZ ${UNIX})
set(CPACK_BINARY_TXZ 0)
set(CPACK_BINARY_TZ 0)
set(CPACK_BINARY_ZIP ${WIN32})
+set(CPACK_BINARY_NSIS ${WIN32})
+set(CPACK_BINARY_NUGET ${WIN32})
# source archive
set(CPACK_SOURCE_TBZ2 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_LICENSE "BSD-3-Clause")
+set(CPACK_PACKAGE_CONTACT "${PROJECT_CONTACT}")
+set(CPACK_PACKAGE_VENDOR "${PROJECT_CONTACT}")
+set(CPACK_PACKAGE_DESCRIPTION
+ "libmemcached is an open source C/C++ client library and tools 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.")
set(CPACK_PACKAGE_INSTALL_DIRECTORY "${CPACK_PACKAGE_NAME}/${CPACK_PACKAGE_VERSION}")
-set(CPACK_PACKAGE_CHECKSUM SHA1)
+#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_SOURCE_IGNORE_FILES "/[.]git/;/[.](idea|settings|c?project);~$;[.]log$;[.]bak$")
+
+set(CPACK_PACKAGE_FILE_NAME
+ "${CMAKE_PROJECT_NAME}-${CMAKE_PROJECT_VERSION}-${CMAKE_SYSTEM_NAME}-${CMAKE_SYSTEM_PROCESSOR}")
+
+set(CPACK_ARCHIVE_COMPONENT_INSTALL ${CPACK_COMPONENT_INSTALL})
+
+# dependencies
+if(HAVE_LIBSASL)
+ string(APPEND CPACK_PACKAGE_DEPENDS " libsasl2")
+endif()
+if(HAVE_TBB)
+ string(APPEND CPACK_PACKAGE_DEPENDS " tbb")
+endif()
+if(HAVE_LIBEVENT)
+ string(APPEND CPACK_PACKAGE_DEPENDS " libevent")
+endif()
+
+
+# DEBs
+if(EXISTS /usr/bin/dpkg)
+ cpack_include_if(DEB)
+endif()
+
+if(APPLE)
+endif()
+
+# BSDs
+if(CMAKE_SYSTEM_NAME MATCHES BSD)
+ cpack_include_if(BSD)
+endif()
+
+# RPMs
+if(EXISTS /usr/bin/dnf OR EXISTS /usr/bin/yum OR EXISTS /usr/bin/rpmbuild)
+ cpack_include_if(RPM)
+endif()
+# keep last
include(CPack)