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. `:`).
This commit is contained in:
Deniz Bahadir committed 2022-05-24 19:07:36 +02:00
1 parent ced9a3b0bb
commit 11ac6751a8
1 file changed
+10 -8
+10 -8
View File
@@ -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"