SET(CPACK_PACKAGE_NAME "@CPACK_PACKAGE_NAME@")
SET(CPACK_PACKAGE_NAME_SIMPLIFIED "@CPACK_PACKAGE_NAME_SIMPLIFIED@")
SET(CPACK_PACKAGE_VERSION_MAJOR "@CPACK_PACKAGE_VERSION_MAJOR@")
SET(CPACK_PACKAGE_VERSION_MINOR "@CPACK_PACKAGE_VERSION_MINOR@")
SET(CPACK_PACKAGE_VERSION_PATCH "@CPACK_PACKAGE_VERSION_PATCH@")
SET(CPACK_INSTALL_DIRECTORY "@CPACK_INSTALL_DIRECTORY@")
SET(CPACK_PACKAGE_VENDOR "KDAB")

SET(CPACK_PACKAGE_VERSION "${CPACK_PACKAGE_VERSION_MAJOR}.${CPACK_PACKAGE_VERSION_MINOR}.${CPACK_PACKAGE_VERSION_PATCH}")
GET_FILENAME_COMPONENT(CPACK_INSTALLED_DIRECTORIES "${CPACK_INSTALL_DIRECTORY}" REALPATH)
LIST(APPEND CPACK_INSTALLED_DIRECTORIES ".")

SET(CPACK_PACKAGE_FILE_NAME "${CPACK_PACKAGE_NAME_SIMPLIFIED}-${CPACK_PACKAGE_VERSION}-source")
SET(CPACK_PACKAGE_NAME_AND_VERSION "${CPACK_PACKAGE_NAME}-${CPACK_PACKAGE_VERSION}-Source")
SET(CPACK_PACKAGE_INSTALL_DIRECTORY "${CPACK_PACKAGE_FILE_NAME}")

IF(WIN32)
	SET(CPACK_GENERATOR "@CPACK_GENERATOR_WINDOWS@")
	SET(CPACK_NSIS_DISPLAY_NAME "${CPACK_PACKAGE_NAME_AND_VERSION}")
	SET(CPACK_NSIS_PACKAGE_NAME "${CPACK_PACKAGE_NAME_AND_VERSION}")
	SET(CPACK_PACKAGE_INSTALL_REGISTRY_KEY "${CPACK_PACKAGE_NAME_AND_VERSION}")
	SET(CPACK_NSIS_INSTALL_ROOT "C:\\KDAB") # use "$PROGRAMFILES" to get "C:\Program Files" or similar
	SET(CPACK_NSIS_URL_INFO_ABOUT "https://www.kdab.com")
	SET(CPACK_NSIS_MENU_LINKS
		"LICENSE.txt" "License" 
		"LICENSE.@PRODUCT_LICENSE_FREE@.txt" "License (@PRODUCT_LICENSE_FREE@)"
		"LICENSE.US.txt" "License (US)"
		"README.txt" "Readme")
	SET(CPACK_PACKAGE_INSTALL_DIRECTORY "${CPACK_PACKAGE_NAME_AND_VERSION}")
ELSEIF(APPLE)
	SET(CPACK_GENERATOR "@CPACK_GENERATOR_APPLE@")
	SET(CPACK_SYSTEM_NAME "OSX")
ELSE()
	SET(CPACK_GENERATOR "@CPACK_GENERATOR_ELSE@")
ENDIF()

SET(CPACK_TOPLEVEL_TAG "${CPACK_SYSTEM_NAME}")
SET(CPACK_RESOURCE_FILE_LICENSE "@CPACK_RESOURCE_FILE_LICENSE@")
FILE(TO_CMAKE_PATH "${CPACK_INSTALL_DIRECTORY}" XPLATFORM_INSTALL_DIR) # to get forward slashes on Windows
SET(CPACK_IGNORE_FILES "^${XPLATFORM_INSTALL_DIR}/autogen.py$" "^${XPLATFORM_INSTALL_DIR}/genignore.py$"
                       "^${XPLATFORM_INSTALL_DIR}/CPackIgnores.txt$"
                        "/\\.svn/" "/\\.git/" "\\.cache$" "/[\\._]moc/" "/[\\._]obj/" "[\\._]ui/"
                       "[\\._]qrc/" "\\.pdb$" "\\.zip$" "\\.exe$" "\\.tar" "Makefile" "CPack"
                       "\\.license\\.accepted$" "/bin/" "/lib/" "/b/"
                       "/debug/" "/release/" "-source/" "/autogen/" @CPACK_EXTRA_IGNORE_FILES@)
SET(CPACK_PACKAGE_DESCRIPTION "")
