From 438cca748004e2ad0016656947951c38f7ba5e19 Mon Sep 17 00:00:00 2001
From: Tobias Leibner <tobias.leibner@googlemail.com>
Date: Wed, 24 Nov 2021 20:02:06 +0100
Subject: [PATCH] Fix cmake-lint errors

---
 cmake/modules/CMakeLists.txt |  4 ++--
 examples/CMakeLists.txt      | 23 ++++++++++++-----------
 2 files changed, 14 insertions(+), 13 deletions(-)

diff --git a/cmake/modules/CMakeLists.txt b/cmake/modules/CMakeLists.txt
index 3b47aacf3..b5c963723 100644
--- a/cmake/modules/CMakeLists.txt
+++ b/cmake/modules/CMakeLists.txt
@@ -10,5 +10,5 @@
 #   René Fritze     (2018)
 # ~~~
 
-set(modules DuneGdtMacros.cmake)
-install(FILES "${modules}" DESTINATION ${CMAKE_INSTALL_DATAROOTDIR}/cmake/modules)
+set(_modules DuneGdtMacros.cmake)
+install(FILES "${_modules}" DESTINATION ${CMAKE_INSTALL_DATAROOTDIR}/cmake/modules)
diff --git a/examples/CMakeLists.txt b/examples/CMakeLists.txt
index a0297dc31..6700856c6 100644
--- a/examples/CMakeLists.txt
+++ b/examples/CMakeLists.txt
@@ -11,20 +11,21 @@
 #   Tobias Leibner  (2018)
 # ~~~
 
-macro(cleanup_target_name arg)
-  string(REPLACE ${PROJECT_SOURCE_DIR} "" targname ${arg})
-  string(REPLACE ".cc" "" targname ${targname})
-  string(REGEX REPLACE "/" "__" targname ${targname})
-  string(REGEX REPLACE "^__" "" targname ${targname})
-endmacro(cleanup_target_name)
+# Removes directory path, .cc suffix and leading __, replaces / with __
+macro(CLEANUP_TARGET_NAME arg)
+  string(REPLACE ${PROJECT_SOURCE_DIR} "" _targname ${arg})
+  string(REPLACE ".cc" "" _targname ${_targname})
+  string(REGEX REPLACE "/" "__" _targname ${_targname})
+  string(REGEX REPLACE "^__" "" _targname ${_targname})
+endmacro(CLEANUP_TARGET_NAME)
 
 file(GLOB_RECURSE example_sources "${CMAKE_CURRENT_SOURCE_DIR}/*.cc")
 foreach(source ${example_sources}) # do some name conversion
-  set(targname ${source})
-  cleanup_target_name(${targname})
-  add_executable(${targname} ${source})
-  list(APPEND examples_targets ${targname})
+  set(_targname ${source})
+  cleanup_target_name(${_targname})
+  add_executable(${_targname} ${source})
+  list(APPEND examples_targets ${_targname})
 endforeach(source ${example_sources})
 
-add_custom_target(examples)
+add_custom_target(examples COMMENT "Selected examples showing some of dune-gdt's features.")
 add_dependencies(examples ${examples_targets})
-- 
GitLab