1 |
Scan build log and report verbosely CMake warnings about unused |
2 |
variables. This is a quite common problem, yet currently it is hard |
3 |
to notice it since the warning is mixed with src_configure() output. |
4 |
Repeat it verbosely after the install. |
5 |
|
6 |
This check outputs warnings such as: |
7 |
|
8 |
* One or more CMake variables were not used by the project: |
9 |
* CMAKE_USER_MAKE_RULES_OVERRIDE |
10 |
--- |
11 |
bin/install-qa-check.d/90cmake-warnings | 28 ++++++++++++++++++++++++++++ |
12 |
1 file changed, 28 insertions(+) |
13 |
create mode 100644 bin/install-qa-check.d/90cmake-warnings |
14 |
|
15 |
diff --git a/bin/install-qa-check.d/90cmake-warnings b/bin/install-qa-check.d/90cmake-warnings |
16 |
new file mode 100644 |
17 |
index 000000000..36a09851b |
18 |
--- /dev/null |
19 |
+++ b/bin/install-qa-check.d/90cmake-warnings |
20 |
@@ -0,0 +1,28 @@ |
21 |
+# Check for CMake invalid option warnings |
22 |
+ |
23 |
+cmake_warn_check() { |
24 |
+ if [[ -n ${PORTAGE_LOG_FILE} && -r ${PORTAGE_LOG_FILE} ]] ; then |
25 |
+ local cat=cat |
26 |
+ [[ ${PORTAGE_LOG_FILE} == *.gz ]] && cat=zcat |
27 |
+ |
28 |
+ local vars=() |
29 |
+ while read -r l; do |
30 |
+ vars+=( "${l}" ) |
31 |
+ done < <( "${cat}" "${PORTAGE_LOG_FILE}" \ |
32 |
+ | sed -n -e '/Manually-specified variables were not used by the project/,/^--/{/^ /p}' \ |
33 |
+ | sort -u) |
34 |
+ |
35 |
+ if [[ ${vars} ]]; then |
36 |
+ eqawarn "One or more CMake variables were not used by the project:" |
37 |
+ local v |
38 |
+ for v in "${vars[@]}"; do |
39 |
+ eqawarn " ${v}" |
40 |
+ done |
41 |
+ fi |
42 |
+ fi |
43 |
+} |
44 |
+ |
45 |
+cmake_warn_check |
46 |
+: # guarantee successful exit |
47 |
+ |
48 |
+# vim:ft=sh |
49 |
-- |
50 |
2.16.1 |