DeployMacros fix and description of deploy_target(FILES) section

This commit is contained in:
2021-04-04 22:01:02 +03:00
parent d3b4147e0f
commit eb559da1a3

View File

@@ -119,6 +119,13 @@ Important! RESOURCES, PLUGINS, FILES and LIBS lists check
at cmake-time, so if entry ends with "/" it treat
as directory, else - file
FILES can be presents as cmake-generator-expressions. In this case
entry trated as absolute path only if it prepened wiht "/".
Examples:
* "/$<TARGET_FILE:myexe>" - right, TARGET_FILE is absolute path
* "$<TARGET_FILE_NAME:myexe>" - right, relative item and TARGET_FILE_NAME is only filename
* "/$<TARGET_FILE_NAME:myexe>" - wrong, absolute item with only filename
This macro using "deploy_tool" from PIP,
so make sure it can be executed from shell
@@ -394,22 +401,33 @@ endmacro()
macro(__add_file_or_dir _DIR_VAR _FILE_VAR _PATH _RELPATH)
set(_p)
set(_remabs 0)
set(_abs 0)
if (IS_ABSOLUTE "${_PATH}")
set(_abs 1)
endif()
if ("${_PATH}" MATCHES "^\$<")
if ("${_PATH}" MATCHES "^\\/\\$")
set(_abs 1)
set(_remabs 1)
endif()
if (_abs)
set(_p "${_PATH}")
else()
set(_p "${_RELPATH}/${_PATH}")
endif()
if ("${_p}" MATCHES ".*/$")
if (_remabs)
#message("b \"${_p}\"")
string(LENGTH "${_p}" __sl)
math(EXPR __sl ${__sl}-1)
string(SUBSTRING "${_p}" 1 ${__sl} _p)
#message("a \"${_p}\"")
endif()
if ("${_p}" MATCHES ".*\\/\$")
#message("b \"${_p}\"")
string(LENGTH "${_p}" __sl)
math(EXPR __sl ${__sl}-1)
string(SUBSTRING "${_p}" 0 ${__sl} _p)
#message("a \"${_p}\"")
list(APPEND ${_DIR_VAR} "${_p}")
else()
list(APPEND ${_FILE_VAR} "${_p}")