From 11ac6751a81a3809923f0269aba3db48042ba9be Mon Sep 17 00:00:00 2001 From: Deniz Bahadir Date: Tue, 24 May 2022 19:07:36 +0200 Subject: CPack: Support component names with special characters, too The macros `cpack_append_variable_set_command` and `cpack_append_string_variable_set_command` became functions, in order to support arguments with special characters (e.g. `:`). --- Modules/CPackComponent.cmake | 18 ++++++++++-------- 1 file changed, 10 insertions(+), 8 deletions(-) diff --git a/Modules/CPackComponent.cmake b/Modules/CPackComponent.cmake index 1f8c38c..8ca9f28 100644 --- a/Modules/CPackComponent.cmake +++ b/Modules/CPackComponent.cmake @@ -327,32 +327,34 @@ OS X. if(NOT CPackComponent_CMake_INCLUDED) set(CPackComponent_CMake_INCLUDED 1) -# Macro that appends a SET command for the given variable name (var) -# to the macro named strvar, but only if the variable named "var" +# Function that appends a SET command for the given variable name (var) +# to the string named strvar, but only if the variable named "var" # has been defined. The string will eventually be appended to a CPack # configuration file. -macro(cpack_append_variable_set_command var strvar) +function(cpack_append_variable_set_command var strvar) if (DEFINED ${var}) string(APPEND ${strvar} "set(${var}") foreach(APPENDVAL ${${var}}) string(APPEND ${strvar} " ${APPENDVAL}") endforeach() string(APPEND ${strvar} ")\n") + set(${strvar} "${${strvar}}" PARENT_SCOPE) endif () -endmacro() +endfunction() -# Macro that appends a SET command for the given variable name (var) -# to the macro named strvar, but only if the variable named "var" +# Function that appends a SET command for the given variable name (var) +# to the string named strvar, but only if the variable named "var" # has been defined and is a string. The string will eventually be # appended to a CPack configuration file. -macro(cpack_append_string_variable_set_command var strvar) +function(cpack_append_string_variable_set_command var strvar) if (DEFINED ${var}) list(LENGTH ${var} CPACK_APP_VALUE_LEN) if(${CPACK_APP_VALUE_LEN} EQUAL 1) string(APPEND ${strvar} "set(${var} \"${${var}}\")\n") endif() + set(${strvar} "${${strvar}}" PARENT_SCOPE) endif () -endmacro() +endfunction() # Macro that appends a SET command for the given list variable name (var) # to the macro named strvar, but only if the variable named "var" -- cgit v0.12