git-svn-id: svn://db.shs.com.ru/libs@894 a8b55f48-bf90-11e4-a774-851b48703e85
This commit is contained in:
@@ -1,14 +1,4 @@
|
||||
if (POLICY CMP0057)
|
||||
cmake_policy(SET CMP0057 NEW) # Support if() IN_LIST
|
||||
endif()
|
||||
set(__prop_names "LABEL;VERSION;FULLNAME;COMPANY;ICON;INFO")
|
||||
include(TargetArch)
|
||||
if (NOT MY_ARCH)
|
||||
target_architecture(MY_ARCH)
|
||||
endif()
|
||||
|
||||
|
||||
# usage: set_deploy_property(<target> NAME <value> [NAME <value> [...]])
|
||||
# set_deploy_property(<target> NAME <value> [NAME <value> [...]])
|
||||
#
|
||||
# Set target deploy property, where NAME one of:
|
||||
# * LABEL - application icon name
|
||||
@@ -20,6 +10,56 @@ endif()
|
||||
#
|
||||
# You can setup several properties in one command
|
||||
#
|
||||
#
|
||||
#
|
||||
#
|
||||
# deploy_target(<target> [DEPLOY_DIR <dir>] [DESTINATION <dir>] [RESOURCE_DIRS <dir> [<dir> ...]])
|
||||
#
|
||||
# DEPLOY_DIR - dir where you install
|
||||
# * executable on Windows, Linux
|
||||
# * <T>.app directory with executable on MacOS
|
||||
#
|
||||
# DESTINATION - dir where macro place package
|
||||
#
|
||||
# Example:
|
||||
# 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
|
||||
#
|
||||
#
|
||||
#
|
||||
#
|
||||
# make_rc(<target> <rc_out_file>)
|
||||
#
|
||||
# Generate Windows *.rc file from deploy properties
|
||||
# and return file path to <rc_out_file>
|
||||
#
|
||||
# You should set deploy properties before
|
||||
# call this macro, see "set_deploy_property()"
|
||||
#
|
||||
#
|
||||
|
||||
|
||||
if (POLICY CMP0057)
|
||||
cmake_policy(SET CMP0057 NEW) # Support if() IN_LIST
|
||||
endif()
|
||||
set(__prop_names "LABEL;VERSION;FULLNAME;COMPANY;ICON;INFO")
|
||||
include(TargetArch)
|
||||
if (NOT MY_ARCH)
|
||||
target_architecture(MY_ARCH)
|
||||
endif()
|
||||
|
||||
|
||||
macro(set_deploy_property _T)
|
||||
set(_name)
|
||||
set(_is_name 1)
|
||||
@@ -39,14 +79,6 @@ macro(set_deploy_property _T)
|
||||
endmacro()
|
||||
|
||||
|
||||
# usage: make_rc(<target> <rc_out_file>)
|
||||
#
|
||||
# Generate Windows *.rc file from deploy properties
|
||||
# and return file path to <rc_out_file>
|
||||
#
|
||||
# You should set deploy properties before
|
||||
# call this macro, see "set_deploy_property()"
|
||||
#
|
||||
macro(make_rc _T _out)
|
||||
if (WIN32)
|
||||
set(WINDOWS_RC_FULLNAME "${${_T}_FULLNAME}")
|
||||
@@ -108,29 +140,6 @@ END
|
||||
endmacro()
|
||||
|
||||
|
||||
# usage: deploy_target(<target> [DEPLOY_DIR <dir>] [DESTINATION <dir>] [RESOURCE_DIRS <dir> [<dir> ...]])
|
||||
#
|
||||
# DEPLOY_DIR - dir where you install
|
||||
# * executable on Windows, Linux
|
||||
# * <T>.app directory with executable on MacOS
|
||||
#
|
||||
# DESTINATION - dir where macro place package
|
||||
#
|
||||
# Example:
|
||||
# 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)
|
||||
set(_DESTINATION "${CMAKE_INSTALL_PREFIX}")
|
||||
set(_DEPLOY_DIR "${CMAKE_INSTALL_PREFIX}")
|
||||
@@ -321,6 +330,7 @@ macro(deploy_target _T)
|
||||
set(MACOSX_BUNDLE_COPYRIGHT "${${_T}_COMPANY}")
|
||||
set(MACOSX_BUNDLE_INFO_STRING "${${_T}_INFO}")
|
||||
set(MACOSX_BUNDLE_BUNDLE_VERSION "6.0")
|
||||
set(MACOSX_BUNDLE_SIGNATURE "????")
|
||||
set_target_properties(${_T} PROPERTIES MACOSX_BUNDLE TRUE)
|
||||
set(_AGD "${_DEPLOY_DIR}/${_T}.app")
|
||||
set(_DMG "${CMAKE_CURRENT_BINARY_DIR}/dmg")
|
||||
@@ -347,7 +357,7 @@ macro(deploy_target _T)
|
||||
COMMAND cp -r ${_AGD} ${_DMG}
|
||||
COMMAND ln --symbolic /Applications ${_DMG}
|
||||
# generate dmg
|
||||
COMMAND genisoimage -quiet -V ${_T} -D -R -apple -no-pad -o ${_DESTINATION}/${_TV}.dmg ${_DMG}
|
||||
COMMAND genisoimage -quiet -V "${MACOSX_BUNDLE_BUNDLE_NAME}" -D -R -apple -no-pad -o ${_DESTINATION}/${_TV}.dmg ${_DMG}
|
||||
COMMENT "Generating ${_TV}.dmg"
|
||||
)
|
||||
endif()
|
||||
|
||||
@@ -1,3 +1,96 @@
|
||||
# find_qt([<Module1> <Module2> ...] [Qt4] [Qt5])
|
||||
#
|
||||
# Find Qt4 or/and Qt5 packages
|
||||
# If Qt4/5 found, set
|
||||
# * Qt<4/5>_ROOT var to Qt root dir
|
||||
# * Qt<4/5>_BIN var to Qt binary dir
|
||||
# * Qt<4/5>_PLUGINS_DIR var to Qt plugins dir
|
||||
#
|
||||
#
|
||||
#
|
||||
#
|
||||
# qt_sources(<src_out_var> [NO_DEFAULT] [DIR <dir>] [<regexp> ...])
|
||||
#
|
||||
# Collect all sources, optionally in directory <dir> and
|
||||
# Additional filters <regexp>. By default filter files with regexps
|
||||
# "*.h", "*.hpp", "*.c", "*.cpp", "*.ui", "*.qrc", "*.rc", "*.ts" and "lang/*.ts".
|
||||
# Default filters disabled with option NO_DEFAULT
|
||||
#
|
||||
#
|
||||
#
|
||||
#
|
||||
# qt_wrap(<file0> <file1> ... [HDRS <hrd_var>] [CPPS <cpp_var>] [QMS <qm_var>])
|
||||
#
|
||||
# Prepare sources for compile
|
||||
# Store headers to <hrd_var>, all wrapped Qt4 files to <cpp_var>_Qt4 and Qt5 files to <cpp_var>_Qt5
|
||||
# version are automatic detected after find_qt() call
|
||||
#
|
||||
#
|
||||
#
|
||||
#
|
||||
# qt_add_executable(<name> [WIN32] [MACOSX_BUNDLE] [EXCLUDE_FROM_ALL] source1 [source2 ...])
|
||||
#
|
||||
# Add executables for founded Qt versions, target names is <name><TARGET_SUFFIX_Qt?>
|
||||
# All needed Qt includes automatic added to corresponding targets
|
||||
# <source> cant be CPPS variable passed to qt_wrap() or some list or filename
|
||||
#
|
||||
#
|
||||
#
|
||||
#
|
||||
# qt_add_library(<name> [STATIC | SHARED | MODULE] [EXCLUDE_FROM_ALL] source1 [source2 ...])
|
||||
#
|
||||
# Add library for founded Qt versions, target names is <name><TARGET_SUFFIX_Qt?>
|
||||
# All needed Qt includes automatic added to corresponding targets
|
||||
# <source> cant be CPPS variable passed to qt_wrap() or some list or filename
|
||||
#
|
||||
#
|
||||
#
|
||||
#
|
||||
# qt_target_link_libraries(<target> ... <item> ...)
|
||||
#
|
||||
# Link targets for founded Qt versions, target names is <name><TARGET_SUFFIX_Qt?>
|
||||
# All needed Qt libraries automatic added to corresponding targets
|
||||
# if QT_MULTILIB_LIST contains some linking library, to it name automatic
|
||||
# add <MULTILIB_SUFFIX_Qt?> or individual <MULTILIB_>libname<_SUFFIX_Qt?>
|
||||
#
|
||||
#
|
||||
#
|
||||
#
|
||||
# qt_target_compile_definitions(...)
|
||||
#
|
||||
# Syntax similar to original "target_compile_definitions()"
|
||||
# Specify compile definitions to use when compiling a given <target>
|
||||
#
|
||||
#
|
||||
#
|
||||
#
|
||||
# qt_target_include_directories(...)
|
||||
#
|
||||
# Syntax similar to original "target_include_directories()"
|
||||
# Add include directories to a target
|
||||
#
|
||||
#
|
||||
#
|
||||
#
|
||||
# qt_install(...)
|
||||
#
|
||||
# Syntax similar to original "install()"
|
||||
# Install targets for founded Qt versions
|
||||
#
|
||||
# if DESTINATION set to "QtBin" files will be installed
|
||||
# to corresponding Qt binary directory
|
||||
# if DESTINATION set to "QtLang" files will be installed
|
||||
# to corresponding Qt translation directory
|
||||
# if DESTINATION starts with "QtPlugins" files will be installed
|
||||
# to corresponding Qt plugins directory
|
||||
#
|
||||
# Add LANG type for first argument - in this case you should
|
||||
# specify variable name, not variable value!
|
||||
# e.g. "qt_install(LANG my_QM DESTINATION QtLang)"
|
||||
#
|
||||
#
|
||||
|
||||
|
||||
cmake_policy(SET CMP0011 NEW) # don`t affect includer policies
|
||||
cmake_policy(SET CMP0020 NEW) # Automatically link Qt executables to qtmain target on Windows
|
||||
|
||||
@@ -16,12 +109,6 @@ endif()
|
||||
#set(TARGET_SUFFIX_Qt4 "")
|
||||
|
||||
|
||||
# usage: find_qt([<Module1> <Module2> ...] [Qt4] [Qt5])
|
||||
# find Qt4 or/and Qt5 packages
|
||||
# if Qt4/5 found, set
|
||||
# * Qt<4/5>_ROOT var to Qt root dir
|
||||
# * Qt<4/5>_BIN var to Qt binary dir
|
||||
# * Qt<4/5>_PLUGINS_DIR var to Qt plugins dir
|
||||
macro(find_qt)
|
||||
set(_QCOMP)
|
||||
foreach(_v ${_QT_VERSIONS_})
|
||||
@@ -139,11 +226,6 @@ macro(find_qt)
|
||||
endmacro()
|
||||
|
||||
|
||||
# usage: qt_sources(<src_out_var> [NO_DEFAULT] [DIR <dir>] [<regexp> ...])
|
||||
# collect all sources, optionally in directory <dir> and
|
||||
# additional filters <regexp>. By default filter files with regexps
|
||||
# "*.h", "*.hpp", "*.c", "*.cpp", "*.ui", "*.qrc", "*.rc", "*.ts" and "lang/*.ts".
|
||||
# Default filters disabled with option NO_DEFAULT
|
||||
macro(qt_sources OUT)
|
||||
set(${OUT})
|
||||
set(_DIR "")
|
||||
@@ -184,10 +266,6 @@ macro(qt_sources OUT)
|
||||
endmacro()
|
||||
|
||||
|
||||
# usage: qt_wrap(<file0> <file1> ... [HDRS <hrd_var>] [CPPS <cpp_var>] [QMS <qm_var>])
|
||||
# prepare sources for compile
|
||||
# store headers to <hrd_var>, all wrapped Qt4 files to <cpp_var>_Qt4 and Qt5 files to <cpp_var>_Qt5
|
||||
# version are automatic detected after find_qt() call
|
||||
macro(qt_wrap)
|
||||
set(HDR_VAR)
|
||||
set(CPP_VAR)
|
||||
@@ -353,10 +431,6 @@ macro(_qt_split_add_args _P _A)
|
||||
endmacro()
|
||||
|
||||
|
||||
# usage: qt_add_executable(<name> [WIN32] [MACOSX_BUNDLE] [EXCLUDE_FROM_ALL] source1 [source2 ...])
|
||||
# add executables for founded Qt versions, target names is <name><TARGET_SUFFIX_Qt?>
|
||||
# all needed Qt includes automatic added to corresponding targets
|
||||
# <source> cant be CPPS variable passed to qt_wrap() or some list or filename
|
||||
macro(qt_add_executable _NAME)
|
||||
foreach(_v ${_QT_VERSIONS_})
|
||||
if (LOCAL_FOUND${_v})
|
||||
@@ -395,10 +469,6 @@ macro(qt_add_executable _NAME)
|
||||
endmacro()
|
||||
|
||||
|
||||
# usage: qt_add_library(<name> [STATIC | SHARED | MODULE] [EXCLUDE_FROM_ALL] source1 [source2 ...])
|
||||
# add library for founded Qt versions, target names is <name><TARGET_SUFFIX_Qt?>
|
||||
# all needed Qt includes automatic added to corresponding targets
|
||||
# <source> cant be CPPS variable passed to qt_wrap() or some list or filename
|
||||
macro(qt_add_library _NAME)
|
||||
foreach(_v ${_QT_VERSIONS_})
|
||||
if (LOCAL_FOUND${_v})
|
||||
@@ -447,11 +517,6 @@ macro(_qt_multitarget_suffix_ _OUT _IN _v)
|
||||
endmacro()
|
||||
|
||||
|
||||
# usage: qt_target_link_libraries(<target> ... <item> ...)
|
||||
# link targets for founded Qt versions, target names is <name><TARGET_SUFFIX_Qt?>
|
||||
# all needed Qt libraries automatic added to corresponding targets
|
||||
# if QT_MULTILIB_LIST contains some linking library, to it name automatic
|
||||
# add <MULTILIB_SUFFIX_Qt?> or individual <MULTILIB_>libname<_SUFFIX_Qt?>
|
||||
macro(qt_target_link_libraries _NAME)
|
||||
foreach(_v ${_QT_VERSIONS_})
|
||||
if (LOCAL_FOUND${_v})
|
||||
@@ -474,8 +539,6 @@ macro(qt_target_link_libraries _NAME)
|
||||
endmacro()
|
||||
|
||||
|
||||
# usage: qt_target_compile_definitions(...), syntax similar to original "target_compile_definitions()"
|
||||
# Specify compile definitions to use when compiling a given <target>
|
||||
macro(qt_target_compile_definitions _NAME)
|
||||
foreach(_v ${_QT_VERSIONS_})
|
||||
if (LOCAL_FOUND${_v})
|
||||
@@ -486,8 +549,6 @@ macro(qt_target_compile_definitions _NAME)
|
||||
endmacro()
|
||||
|
||||
|
||||
# usage: qt_target_include_directories(...), syntax similar to original "target_include_directories()"
|
||||
# Add include directories to a target
|
||||
macro(qt_target_include_directories _NAME)
|
||||
foreach(_v ${_QT_VERSIONS_})
|
||||
if (LOCAL_FOUND${_v})
|
||||
@@ -498,15 +559,6 @@ macro(qt_target_include_directories _NAME)
|
||||
endmacro()
|
||||
|
||||
|
||||
# usage: qt_install(...), syntax similar to original "install()"
|
||||
# install targets for founded Qt versions
|
||||
# if DESTINATION set to "QtBin" files will be installed
|
||||
# to corresponding Qt binary directory
|
||||
# if DESTINATION set to "QtLang" files will be installed
|
||||
# to corresponding Qt translation directory
|
||||
# if DESTINATION starts with "QtPlugins" files will be installed
|
||||
# to corresponding Qt plugins directory
|
||||
# add LANG type for first argument
|
||||
macro(qt_install)
|
||||
set(_prev_inst)
|
||||
#message("command: ${ARGN}")
|
||||
|
||||
Reference in New Issue
Block a user