-# CPack packaging
-#
-# http://cmake.org/cmake/help/cmake-2-8-docs.html#module:CPack
-
-set(CPACK_PACKAGE_VERSION_MAJOR "${LYX_MAJOR_VERSION}")
-set(CPACK_PACKAGE_VERSION_MINOR "${LYX_MINOR_VERSION}")
-FILE(STRINGS "${TOP_SRC_DIR}/${LYX_CMAKE_DIR}/LyX_summary.txt" CPACK_PACKAGE_DESCRIPTION_SUMMARY)
-
-set(CPACK_SOURCE_GENERATOR TGZ ZIP TBZ2)
-set(CPACK_SOURCE_INSTALLED_DIRECTORIES "${TOP_SRC_DIR};/") # http://www.mail-archive.com/cmake@cmake.org/msg33720.html
-
-set(CPACK_PACKAGE_INSTALL_DIRECTORY "CMake ${LYX_INSTALL_SUFFIX}")
-
-set(CPACK_SOURCE_GENERATOR TGZ ZIP TBZ2)
-set(CPACK_SOURCE_INSTALLED_DIRECTORIES "${TOP_SRC_DIR};/") # http://www.mail-archive.com/cmake@cmake.org/msg33720.html
-#
-# needed by rpm
-set(CPACK_SET_DESTDIR "ON")
-FILE(READ "${TOP_SRC_DIR}/${LYX_CMAKE_DIR}/LyX_license.txt" CPACK_RPM_PACKAGE_LICENSE)
-set(CPACK_RPM_PACKAGE_GROUP "Applications/Publishing")
-set(CPACK_RPM_PACKAGE_VENDOR "The LyX team")
-#
-# the next ones are needed by deb
-set(CPACK_PACKAGE_CONTACT "${PACKAGE_BUGREPORT}")
-set(CPACK_SOURCE_PACKAGE_FILE_NAME "${LYX_PROJECT}-${LYX_INSTALL_SUFFIX}")
-
-# This is experimental, valid on _my_ system (Kornel)
-set(CPACK_DEBIAN_PACKAGE_DEPENDS "libqtgui4 (>= 4.4.3-0)")
-if(ASPELL_FOUND)
- set(CPACK_DEBIAN_PACKAGE_DEPENDS "libaspell15 (>= 0.60.6-1),${CPACK_DEBIAN_PACKAGE_DEPENDS}")
-endif()
-if(ENCHANT_FOUND)
- set(CPACK_DEBIAN_PACKAGE_DEPENDS "libenchant1c2a (>= 1.6.0-0),${CPACK_DEBIAN_PACKAGE_DEPENDS}")
-endif()
-if(LYX_EXTERNAL_BOOST)
- if(Boost_FOUND)
- set(CPACK_DEBIAN_PACKAGE_DEPENDS "libboost-regex1.40.0 (>= 1.40.0-4),libboost-signals1.40.0 (>= 1.40.0-4),${CPACK_DEBIAN_PACKAGE_DEPENDS}")
- endif()
-endif()
-#
-# for the next ones, cpack insists on data with values in some file
-set(CPACK_PACKAGE_DESCRIPTION_FILE "${TOP_SRC_DIR}/${LYX_CMAKE_DIR}/LyX_description.txt")
-set(CPACK_RESOURCE_FILE_LICENSE "${TOP_SRC_DIR}/${LYX_CMAKE_DIR}/LyX_license.txt")
-
-# Find the revision number and use it as the release in rpm-package-build.
-# This way we may omit the otherwise needed "--force" parameter when
-# installing from that rpm package.
-FIND_PROGRAM(LYX_SVNVERSION svnversion)
-#message(STATUS "svnversion = ${LYX_SVNVERSION}")
-if(NOT ${LYX_SVNVERSION} MATCHES "-NOTFOUND")
- EXECUTE_PROCESS(COMMAND ${LYX_SVNVERSION} WORKING_DIRECTORY "${TOP_SRC_DIR}" OUTPUT_VARIABLE CPACK_RPM_PACKAGE_RELEASE OUTPUT_STRIP_TRAILING_WHITESPACE)
- # We use this value also to set the package-patch-value
- if(CPACK_RPM_PACKAGE_RELEASE MATCHES "^\([0-9]+\)")
- set(CPACK_PACKAGE_VERSION_PATCH ${CMAKE_MATCH_1})
- endif()
-endif()
-
-# we do not have a readme or welcome data,
-# so we do not provide infofiles for
-# CPACK_RESOURCE_FILE_README and CPACK_RESOURCE_FILE_WELCOME
-
-if(WIN32)
- set(CPACK_GENERATOR NSIS ZIP)
- set(CPACK_BINARY_ZIP 1)
-endif()
-
-
-set(CPACK_STRIP_FILES 1)
-
-# sources
-set(CPACK_SOURCE_INSTALLED_DIRECTORIES "${TOP_SRC_DIR};/") # http://www.mail-archive.com/cmake@cmake.org/msg33720.html
-set(CPACK_SOURCE_GENERATOR TGZ ZIP TBZ2)
-
-
-if(LYX_DMG)
- set(CPACK_PACKAGE_NAME LyX)
- set(CPACK_GENERATOR DragNDrop)
-
- # We start from bin/lyx.app, all is build into the final bundle folder
- # On Mac the paths to required shared libraries are hardcoded in the
- # binary/library. This is fixed by the macro 'fixup_bundle'
- # Hardcoded pathes to libraries are resolved automatically
-
-
- set(app ${bundle_dir}/LyX.app)
- set(contents_dir LyX.app/Contents/)
- install(DIRECTORY "${QT_PLUGINS_DIR}/imageformats" DESTINATION ${bundle_dir}/${contents_dir}/plugins COMPONENT Runtime)
-
- message(STATUS "Qt Plugins: ${QT_PLUGINS_DIR}/imageformats DESTINATION ${bundle_dir}/${contents_dir}/plugins")
-
- install(CODE
- "file(GLOB qt_plugins \"${bundle_dir}/${contents_dir}/plugins/imageformats/*${CMAKE_SHARED_LIBRARY_SUFFIX}\")
- include(BundleUtilities)
- fixup_bundle(\"${app}\" \"\${qt_plugins}\" \"${dir}\") "
- COMPONENT RUNTIME)
-
- file(WRITE ${CMAKE_BINARY_DIR}/qt.conf "")
- install(FILES ${CMAKE_BINARY_DIR}/qt.conf DESTINATION ${contents_dir}/Resources COMPONENT Runtime)
-
-endif()
-
-
-if(LYX_CPACK)
- include(CPack)
-endif()
-
-#Now it is possible to create some packages
-# cd <BuildDir>
-# make package
-#############################################################################################
-# So, e.g. for variables
-# CMAKE_PROJECT_NAME : lyx
-# CPACK_PACKAGE_VERSION_MAJOR : 2
-# CPACK_PACKAGE_VERSION_MINOR : 0
-# CPACK_PACKAGE_VERSION_PATCH : 1
-# CMAKE_SYSTEM_NAME : Linux
-# CPACK_BINARY_DEB:BOOL : ON
-#
-# the package name builds as "lyx-2.0.1-Linux.deb"
-#
-############################## rpm ################################### deb ##################
-# create # cpack -G RPM --config CPackConfig.cmake # cpack -G DEB --config CPackConfig.cmake
-# creates =># lyx-2.0.1-Linux.rpm # lyx-2.0.1-Linux.deb
-# list # rpm -qlp lyx-2.0.1-Linux.rpm # dpkg-deb -c lyx-2.0.1-Linux.deb
-# install # rpm -U lyx-2.0.1-Linux.rpm # dpkg -i lyx-2.0.1-Linux.deb
-#