git-svn-id: svn://db.shs.com.ru/libs@813 a8b55f48-bf90-11e4-a774-851b48703e85

This commit is contained in:
2020-03-16 21:44:40 +00:00
parent 0a5080164d
commit 103d10cab6

View File

@@ -1,3 +1,40 @@
if (POLICY CMP0057)
cmake_policy(SET CMP0057 NEW)
endif()
set(__prop_names "LABEL;VERSION;FULLNAME;COMPANY;ICON;INFO")
# usage: set_deploy_property(<target> NAME <value> [NAME <value> [...]])
#
# Set target deploy property, where NAME one of:
# * LABEL - application icon name
# * VERSION - version
# * FULLNAME - package name in format "*.*.*"
# * COMPANY - company name
# * ICON - icon file
# * INFO - additional info
#
# You can setup several properties in one command
#
macro(set_deploy_property _T)
set(_name)
set(_is_name 1)
foreach(_i ${ARGN})
if (_is_name)
set(_is_name 0)
if (_i IN_LIST __prop_names)
else()
message(FATAL_ERROR "Invalid property name \"${_i}\"!")
endif()
set(_name ${_i})
else()
set(_is_name 1)
set(${_T}_${_name} {_i})
endif()
endforeach()
endmacro()
# usage: deploy_target(<target> <full_app_name> <version> <icon> <label> <copyright> <info>
# [DEPLOY_DIR <dir>] [DESTINATION <dir>] [NO_AUTO_ICON_EXT])
#
@@ -8,26 +45,21 @@
# DESTINATION - dir where macro place package
#
# Example:
# deploy_target(my_app
# "org.Company.my_app"
# "0.0.1"
# "icons/my_app.icns"
# "My Application"
# "Company"
# "Info about My Application"
# DESTINATION packages
# deploy_target(my_app DESTINATION packages)
#
# Create make target "deploy"
#
# This macro use "deploy_tool" from sdk,
# make sure it can be executed from shell
# You should set deploy properties before
# call this macro, see "set_deploy_property()"
#
# use "CMAKE_OTOOL" or "CMAKE_OBJDUMP" variable,
# depends on target platform
# can use "DEPLOY_ADD_LIBPATH" variable as additional
# library search path
#
macro(deploy_target _T full_app_name version icon label copyright info)
macro(deploy_target _T)
set(_DESTINATION "${CMAKE_INSTALL_PREFIX}")
set(_DEPLOY_DIR "${CMAKE_INSTALL_PREFIX}")
set(_is_dest 0)
@@ -68,13 +100,13 @@ macro(deploy_target _T full_app_name version icon label copyright info)
endforeach()
#message("app depend libpath ${_DEP_LIBPATH}")
if (APPLE)
set(MACOSX_BUNDLE_GUI_IDENTIFIER "${full_app_name}")
set(MACOSX_BUNDLE_SHORT_VERSION_STRING "${version}")
set(MACOSX_BUNDLE_LONG_VERSION_STRING "${version}")
set(MACOSX_BUNDLE_ICON_FILE "${_ICON_NAME}")
set(MACOSX_BUNDLE_BUNDLE_NAME "${label}")
set(MACOSX_BUNDLE_COPYRIGHT "${copyright}")
set(MACOSX_BUNDLE_INFO_STRING "${info}")
set(MACOSX_BUNDLE_GUI_IDENTIFIER "${${_T}_FULLNAME}")
set(MACOSX_BUNDLE_SHORT_VERSION_STRING "${${_T}_VERSION}")
set(MACOSX_BUNDLE_LONG_VERSION_STRING "${${_T}_VERSION}")
set(MACOSX_BUNDLE_ICON_FILE "${${_T}_ICON}")
set(MACOSX_BUNDLE_BUNDLE_NAME "${${_T}_LABEL}")
set(MACOSX_BUNDLE_COPYRIGHT "${${_T}_COMPANY}")
set(MACOSX_BUNDLE_INFO_STRING "${${_T}_INFO}")
set(MACOSX_BUNDLE_BUNDLE_VERSION "6.0")
set_target_properties(${_T} PROPERTIES MACOSX_BUNDLE TRUE)
set(_AGD "${_DEPLOY_DIR}/${_T}.app")