From e00e4acb1228491d7aebd45779e7337c2fab9cc7 Mon Sep 17 00:00:00 2001 From: Bryce Harrington Date: Fri, 15 Jan 2016 23:54:47 -0800 Subject: cmake: Move join() to helper functions module (bzr r14588) --- CMakeScripts/HelperFunctions.cmake | 15 +++++++++++++++ 1 file changed, 15 insertions(+) (limited to 'CMakeScripts/HelperFunctions.cmake') 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() -- cgit v1.2.3 From d278cb2d3be7ab401d6aae48fb39cabe8387f622 Mon Sep 17 00:00:00 2001 From: Bryce Harrington Date: Sat, 16 Jan 2016 23:05:58 -0800 Subject: cmake: Fix code style for consistency Indentation to 4 spaces Prefer lower case for functions and macros (bzr r14596) --- CMakeScripts/HelperFunctions.cmake | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) (limited to 'CMakeScripts/HelperFunctions.cmake') diff --git a/CMakeScripts/HelperFunctions.cmake b/CMakeScripts/HelperFunctions.cmake index 85cbe7157..f4ed255d5 100644 --- a/CMakeScripts/HelperFunctions.cmake +++ b/CMakeScripts/HelperFunctions.cmake @@ -12,8 +12,8 @@ function(pkg_check_variable _pkg _name) set(_output_name "${_pkg_upper}_${_name_upper}") execute_process(COMMAND ${PKG_CONFIG_EXECUTABLE} --variable=${_name} ${_pkg} - OUTPUT_VARIABLE _pkg_result - OUTPUT_STRIP_TRAILING_WHITESPACE) + OUTPUT_VARIABLE _pkg_result + OUTPUT_STRIP_TRAILING_WHITESPACE) set("${_output_name}" "${_pkg_result}" CACHE STRING "pkg-config variable ${_name} of ${_pkg}") endfunction() -- cgit v1.2.3