diff options
| author | Bryce Harrington <bryce@bryceharrington.org> | 2016-01-16 07:54:47 +0000 |
|---|---|---|
| committer | bryce <bryce@bryceharrington.org> | 2016-01-16 07:54:47 +0000 |
| commit | e00e4acb1228491d7aebd45779e7337c2fab9cc7 (patch) | |
| tree | 00d72e6c4bf28c001d5734ef15502c9c17485fd0 /CMakeScripts/HelperFunctions.cmake | |
| parent | cmake: Don't check for cmake_policy (diff) | |
| download | inkscape-e00e4acb1228491d7aebd45779e7337c2fab9cc7.tar.gz inkscape-e00e4acb1228491d7aebd45779e7337c2fab9cc7.zip | |
cmake: Move join() to helper functions module
(bzr r14588)
Diffstat (limited to 'CMakeScripts/HelperFunctions.cmake')
| -rw-r--r-- | CMakeScripts/HelperFunctions.cmake | 15 |
1 files changed, 15 insertions, 0 deletions
diff --git a/CMakeScripts/HelperFunctions.cmake b/CMakeScripts/HelperFunctions.cmake index 0e6fff51a..85cbe7157 100644 --- a/CMakeScripts/HelperFunctions.cmake +++ b/CMakeScripts/HelperFunctions.cmake @@ -17,3 +17,18 @@ function(pkg_check_variable _pkg _name) set("${_output_name}" "${_pkg_result}" CACHE STRING "pkg-config variable ${_name} of ${_pkg}") endfunction() + +# Join a cmake list of strings with a given glue character/string +# E.g. join(MY_RESULT, ",", "1; 2; 3;") returns "1, 2, 3" +function(join OUTPUT GLUE) + set(_TMP_RESULT "") + set(_GLUE "") # effective glue is empty at the beginning + foreach(arg ${ARGN}) + # Skip empty lines + if(NOT arg STREQUAL "\n") + set(_TMP_RESULT "${_TMP_RESULT}${_GLUE}${arg}") + set(_GLUE "${GLUE}") + endif() + endforeach() + set(${OUTPUT} "${_TMP_RESULT}" PARENT_SCOPE) +endfunction() |
