diff options
author | Konstantin Podsvirov <konstantin@podsvirov.pro> | 2016-06-28 22:06:17 +0300 |
---|---|---|
committer | Konstantin Podsvirov <konstantin@podsvirov.pro> | 2016-06-29 19:10:41 +0300 |
commit | cd1415b548cd19652d71056dff09f0c31a8260a0 (patch) | |
tree | 04518105d2c102c6ef0d82b09ce57467975c12da /Modules/CPackComponent.cmake | |
parent | 4bbfea17510d25c950747c4b0f877e5d5b1f528e (diff) | |
download | cmake-cd1415b548cd19652d71056dff09f0c31a8260a0.tar.gz |
CPackComponents: add cpack_append_list_variable_set_command
It's like add variable, but wrap each item to quotes.
Can be used for multi args properties.
Diffstat (limited to 'Modules/CPackComponent.cmake')
-rw-r--r-- | Modules/CPackComponent.cmake | 14 |
1 files changed, 14 insertions, 0 deletions
diff --git a/Modules/CPackComponent.cmake b/Modules/CPackComponent.cmake index 038a717344..6a330867e1 100644 --- a/Modules/CPackComponent.cmake +++ b/Modules/CPackComponent.cmake @@ -360,6 +360,20 @@ macro(cpack_append_string_variable_set_command var strvar) endif () endmacro() +# 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" +# has been defined. It's like add variable, but wrap each item to quotes. +# The string will eventually be appended to a CPack configuration file. +macro(cpack_append_list_variable_set_command var strvar) + if (DEFINED ${var}) + string(APPEND ${strvar} "set(${var}") + foreach(_val IN LISTS ${var}) + string(APPEND ${strvar} "\n \"${_val}\"") + endforeach() + string(APPEND ${strvar} ")\n") + endif () +endmacro() + # Macro that appends a SET command for the given variable name (var) # to the macro named strvar, but only if the variable named "var" # has been set to true. The string will eventually be |