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) --- CMakeLists.txt | 16 ++-------------- CMakeScripts/HelperFunctions.cmake | 15 +++++++++++++++ 2 files changed, 17 insertions(+), 14 deletions(-) diff --git a/CMakeLists.txt b/CMakeLists.txt index cc5dbfe13..62e976852 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -29,6 +29,8 @@ if(CMAKE_COMPILER_IS_GNUCC) endif() endif() +include(CMakeScripts/HelperFunctions.cmake) + # # Set platform defaults (originally copied from darktable) # @@ -47,7 +49,6 @@ if(APPLE) endif() # detect current GTK+ backend - include(${CMAKE_SOURCE_DIR}/CMakeScripts/HelperFunctions.cmake) pkg_check_variable(gtk+-2.0 target) message("GTK2 backend: ${GTK+_2.0_TARGET}") @@ -196,19 +197,6 @@ macro(pod2man PODFILE_FULL RELEASE SECTION CENTER) endif() endmacro(pod2man PODFILE NAME SECTION CENTER) -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() - # Load AUTHORS file contents into $INKSCAPE_AUTHORS FILE(READ ${CMAKE_CURRENT_SOURCE_DIR}/AUTHORS content) STRING(REGEX REPLACE "^([^\n#]+)\n" "\\1;\n" content_list "${content}") 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