From eb559da1a30958db08d4ff982417374a037dcbd1 Mon Sep 17 00:00:00 2001 From: peri4 Date: Sun, 4 Apr 2021 22:01:02 +0300 Subject: [PATCH] DeployMacros fix and description of deploy_target(FILES) section --- DeployMacros.cmake | 22 ++++++++++++++++++++-- 1 file changed, 20 insertions(+), 2 deletions(-) diff --git a/DeployMacros.cmake b/DeployMacros.cmake index 41a4bfc..2838ec6 100644 --- a/DeployMacros.cmake +++ b/DeployMacros.cmake @@ -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: + * "/$" - right, TARGET_FILE is absolute path + * "$" - right, relative item and TARGET_FILE_NAME is only filename + * "/$" - 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}")