From eca375ce246f7e36529d336b1282b39348774f17 Mon Sep 17 00:00:00 2001
From: Tobias Leibner <tobias.leibner@googlemail.com>
Date: Thu, 24 May 2018 00:13:07 +0200
Subject: [PATCH] [cmake] fix Hints.cmake

---
 cmake/modules/FindClangFormat.cmake |  2 --
 cmake/modules/Hints.cmake           | 18 +++++++++---------
 2 files changed, 9 insertions(+), 11 deletions(-)

diff --git a/cmake/modules/FindClangFormat.cmake b/cmake/modules/FindClangFormat.cmake
index cecbfe690..6449fd4ed 100644
--- a/cmake/modules/FindClangFormat.cmake
+++ b/cmake/modules/FindClangFormat.cmake
@@ -22,8 +22,6 @@
 #   and ClangFormat_FOUND accordingly
 # ~~~
 
-#include(Hints)
-
 find_program(ClangFormat_EXECUTABLE NAMES clang-format-3.9 clang-format)
 if(EXISTS ${ClangFormat_EXECUTABLE})
   execute_process(COMMAND ${ClangFormat_EXECUTABLE} -version OUTPUT_VARIABLE clang_out)
diff --git a/cmake/modules/Hints.cmake b/cmake/modules/Hints.cmake
index 68c702c36..0e235013b 100644
--- a/cmake/modules/Hints.cmake
+++ b/cmake/modules/Hints.cmake
@@ -1,8 +1,8 @@
-function(APPEND_TO_EACH inputlist postfix outputlist)
-  foreach(entry inputlist)
-    list(APPEND ${outputlist} ${entry}${postfix})
-  endforeach(entry inputlist)
-endfunction()
+macro(append_to_each INPUTLIST POSTFIX OUTPUTLIST)
+  foreach(ENTRY ${INPUTLIST})
+    list(APPEND ${OUTPUTLIST} ${ENTRY}${POSTFIX})
+  endforeach(ENTRY ${INPUTLIST})
+endmacro()
 
 set(hint_prefixes
     "${CMAKE_SOURCE_DIR}/../local/"
@@ -12,11 +12,11 @@ set(hint_prefixes
     "$ENV{HOME}/Software/")
 
 set(bin_hints "")
-append_to_each(hint_prefixes "bin/" bin_hints)
+append_to_each("${hint_prefixes}" "bin/" bin_hints)
 
-set(lib_hints "")
-append_to_each(hint_prefixes "lib/" lib_hints)
+set(lib_hint "")
+append_to_each("${hint_prefixes}" "lib/" lib_hints)
 
 set(include_hints "")
-append_to_each(hint_prefixes "include/" include_hints)
+append_to_each("${hint_prefixes}" "include/" include_hints)
 
-- 
GitLab